]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
secret: Have virSecretObjNew return locked object
authorJohn Ferlan <jferlan@redhat.com>
Thu, 20 Apr 2017 15:22:21 +0000 (11:22 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 25 Apr 2017 19:33:22 +0000 (15:33 -0400)
Rather than have caller need to do it, have the object returned locked.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/conf/virsecretobj.c

index cc184596184334276383d4ef6bd09b80246e0a10..55624f4c1a02ef88e6026a521b7f78c78a3bf9bd 100644 (file)
@@ -97,6 +97,8 @@ virSecretObjNew(void)
     if (!(secret = virObjectLockableNew(virSecretObjClass)))
         return NULL;
 
+    virObjectLock(secret);
+
     return secret;
 }
 
@@ -386,8 +388,6 @@ virSecretObjListAddLocked(virSecretObjListPtr secrets,
         if (!(secret = virSecretObjNew()))
             goto cleanup;
 
-        virObjectLock(secret);
-
         if (virHashAddEntry(secrets->objs, uuidstr, secret) < 0)
             goto cleanup;