diff --git a/daemon/remote.c b/daemon/remote.c index 2dcec1ea5ac060ec1f8c83d06c00196d763682bd..c2111ae378a266db19639097f2b6853a5d006806 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -1738,11 +1738,9 @@ void remoteClientFreeFunc(void *data) { struct daemonClientPrivate *priv = data; - /* Deregister event delivery callback */ - if (priv->conn) { - remoteClientFreePrivateCallbacks(priv); + if (priv->conn) virConnectClose(priv->conn); - } + VIR_FREE(priv); } @@ -1752,6 +1750,10 @@ static void remoteClientCloseFunc(virNetServerClientPtr client) struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); daemonRemoveAllClientStreams(priv->streams); + + /* Deregister event delivery callback */ + if (priv->conn) + remoteClientFreePrivateCallbacks(priv); }