aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-02-12 23:16:06 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-13 11:57:25 -0600
commitcc2a90432d9cb7546a2c4360ad7200a2fb3af31a (patch)
tree1ab3f28a1e606937e4d51abb93145d2ed72cdb19
parent91b0a8f33419573c1d741e49559bfb666fd8b1f0 (diff)
net: Avoid NULL function pointer dereference on cleanup
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>
-rw-r--r--net/net.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/net.c b/net/net.c
index f9e7136a2b..be03a8dd14 100644
--- 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)