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;
}