]> git.proxmox.com Git - qemu.git/commitdiff
net: Avoid NULL function pointer dereference on cleanup
authorAndreas Färber <afaerber@suse.de>
Tue, 12 Feb 2013 22:16:06 +0000 (23:16 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 13 Feb 2013 17:57:25 +0000 (11:57 -0600)
The pSeries machine and some other devices don't supply a cleanup
callback. Revert part of 1ceef9f27359cbe92ef124bf74de6f792e71f6fb that
started calling it unconditionally.

Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id: 1360707366-9271-1-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net/net.c

index f9e7136a2bfdb13ac6ba5d8b3b21cc8764813910..be03a8dd1472a96afb319980f4afdad3ed20a41b 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -287,7 +287,9 @@ static void qemu_cleanup_net_client(NetClientState *nc)
 {
     QTAILQ_REMOVE(&net_clients, nc, next);
 
-    nc->info->cleanup(nc);
+    if (nc->info->cleanup) {
+        nc->info->cleanup(nc);
+    }
 }
 
 static void qemu_free_net_client(NetClientState *nc)