[libvirt] [PATCH] rpc: fix segmentation fault caused by null client-sock

Guannan Ren gren at redhat.com
Mon Aug 27 09:09:41 UTC 2012


BZ:https://bugzilla.redhat.com/show_bug.cgi?id=851423
The client-sock could have been set to NULL by eventloop thread
after async event fired.
---
 src/rpc/virnetclient.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 4ecc703..43a9814 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -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;
 }
-- 
1.7.11.4




More information about the libvir-list mailing list