diff options
author | Chen Gang <gang.chen.5i5j@gmail.com> | 2014-12-17 04:52:16 +0800 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2015-01-12 10:16:23 +0000 |
commit | d46858377b822b820946c6b2e3a9153ee0aebd37 (patch) | |
tree | 1a4880c7ae3842ecd30c0fb7b8a23c06ea5d29d0 /hw/net/xen_nic.c | |
parent | b4f72e31b924bec2c18fe0b2a8c6462dbed9dcb2 (diff) |
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 <gang.chen.5i5j@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/net/xen_nic.c')
-rw-r--r-- | hw/net/xen_nic.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c index 7a57feb29b..8eaa77b62d 100644 --- a/hw/net/xen_nic.c +++ b/hw/net/xen_nic.c @@ -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; } |