diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 4ecc7035bcbec9a089eed38c1d52dc68fb9d6874..43a9814b78dfeb76daee0a29d7b1a16048ebd3a9 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; }