From: John Ferlan Date: Sat, 28 Oct 2017 21:03:20 +0000 (-0400) Subject: lockd: Need to Unref @srv when done with it. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=82fa7fc3ab5a2dd6af22c7addbe451f825105c96;p=libvirt.git lockd: Need to Unref @srv when done with it. Commit id '252610f7d' used a hash table to store the @srv, but didn't handle the virObjectUnref if virNetDaemonNew failed nor did it use virObjectUnref once successfully placed into the table which will now be managing it's lifetime (and would cause the virObjectRef if successfully inserted into the table). --- diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index fe3eaf9032..1b7fd86b3a 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -173,6 +173,8 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged) if (!(lockd->dmn = virNetDaemonNew()) || virNetDaemonAddServer(lockd->dmn, srv) < 0) goto error; + virObjectUnref(srv); + srv = NULL; if (!(lockd->lockspaces = virHashCreate(VIR_LOCK_DAEMON_NUM_LOCKSPACES, virLockDaemonLockSpaceDataFree))) @@ -184,6 +186,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged) return lockd; error: + virObjectUnref(srv); virLockDaemonFree(lockd); return NULL; }