]> xenbits.xensource.com Git - libvirt.git/commitdiff
lockd: Need to Unref @srv when done with it.
authorJohn Ferlan <jferlan@redhat.com>
Sat, 28 Oct 2017 21:03:20 +0000 (17:03 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 6 Nov 2017 20:53:41 +0000 (15:53 -0500)
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).

src/locking/lock_daemon.c

index fe3eaf90322a1f7c528c24a1a99d7ad5d76efd8c..1b7fd86b3ab11b9f02fc255e9170fc2ddbc0534d 100644 (file)
@@ -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;
 }