hw/net/xen_nic.c: Need free 'netdev->nic' in net_free() instead of net_disconnect()
PATCH 1/1 hw/net/xen_nic.c: Need free 'netdev->nic' in net_free() instead of net_disconnect()
net_init() and net_free() are pairs, net_connect() and net_disconnect() are pairs. net_init() creates 'netdev->nic', so also need free it in net_free().
Signed-off-by Chen Gang <[email protected]>
--- hw/net/xen_nic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/net/xen_nic.c +4 -4
@@ -410,10 +410,6 @@ static void net_disconnect(struct XenDevice *xendev)xc_gnttab_munmap (netdev->xendev.gnttabdev, netdev->rxs,1 ); netdev->rxs =NULL ; } -if (netdev->nic) { -qemu_del_nic (netdev->nic); - netdev->nic =NULL ; - } }static void net_event (struct XenDevice *xendev)
@@ -427,6 +423,10 @@ static int net_free(struct XenDevice *xendev) { struct XenNetDev *netdev = container_of(xendev, struct XenNetDev, xendev); +if (netdev->nic) { +qemu_del_nic (netdev->nic); + netdev->nic =NULL ; + }g_free (netdev->mac);return 0 ; }
Signature · 1 line
1.9.3
Stefan Hajnoczi
AppliedQuoted 8 lines · Chen Gang
net_init()andnet_free()are pairs,net_connect()andnet_disconnect()are pairs.net_init()creates 'netdev->nic', so also need free it innet_free().Signed-off-by Chen Gang <[email protected]>--- hw/net/xen_nic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net
Stefan