]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
rpc: fix segmentation fault caused by null client-sock
authorGuannan Ren <gren@redhat.com>
Mon, 27 Aug 2012 08:59:25 +0000 (16:59 +0800)
committerGuannan Ren <gren@redhat.com>
Mon, 27 Aug 2012 08:59:25 +0000 (16:59 +0800)
The client-sock could have been set to NULL by eventloop thread
after async event fired.

src/rpc/virnetclient.c

index 4ecc7035bcbec9a089eed38c1d52dc68fb9d6874..43a9814b78dfeb76daee0a29d7b1a16048ebd3a9 100644 (file)
@@ -644,7 +644,8 @@ virNetClientMarkClose(virNetClientPtr client,
                       int reason)
 {
     VIR_DEBUG("client=%p, reason=%d", client, reason);
-    virNetSocketRemoveIOCallback(client->sock);
+    if (client->sock)
+        virNetSocketRemoveIOCallback(client->sock);
     client->wantClose = true;
     client->closeReason = reason;
 }