Rather than have caller need to do it, have the object returned locked.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/conf/virsecretobj.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index 064e66c..348feb3 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -97,6 +97,8 @@ virSecretObjNew(void)
if (!(secret = virObjectLockableNew(virSecretObjClass)))
return NULL;
+ virObjectLock(secret);
+
return secret;
}
@@ -367,8 +369,6 @@ virSecretObjListAddLocked(virSecretObjListPtr secrets,
if (!(secret = virSecretObjNew()))
goto cleanup;
- virObjectLock(secret);
-
if (virHashAddEntry(secrets->objs, uuidstr, secret) < 0)
goto cleanup;
--
2.9.3