This commit resolves illegal memory accesses observed via:

  remoteClientFreePrivateCallbacks()
  remoteClientCloseFunc()
  virNetServerClientCloseLocked()
  virNetServerProcessClients()
  daemonServerProcessClients()
  virHashForEach()
  virNetDaemonRun()
  main()

Signed-off-by: Mike Pontillo <mponti...@digitalocean.com>
---
 src/remote/remote_daemon_dispatch.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index 250eb51e6b..8d043d0bce 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1711,6 +1711,8 @@ remoteClientFreePrivateCallbacks(struct 
daemonClientPrivate *priv)
     g_autoptr(virIdentity) sysident = virIdentityGetSystem();
     virIdentitySetCurrent(sysident);
 
+    virMutexLock(&priv->lock);
+
     DEREG_CB(priv->conn, priv->domainEventCallbacks,
              priv->ndomainEventCallbacks,
              virConnectDomainEventDeregisterAny, "domain");
@@ -1737,6 +1739,8 @@ remoteClientFreePrivateCallbacks(struct 
daemonClientPrivate *priv)
     }
 
     virIdentitySetCurrent(NULL);
+
+    virMutexUnlock(&priv->lock);
 }
 #undef DEREG_CB
 
-- 
2.34.1

Reply via email to