[PATCH v2 02/11] secret: Add NULL obj check to virSecretObjListRemove

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rather than have the caller check if !obj before calling, just check
in the function for !obj and return.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/virsecretobj.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index 169a60b..7c2ad90 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -298,6 +298,9 @@ virSecretObjListRemove(virSecretObjListPtr secrets,
 {
     char uuidstr[VIR_UUID_STRING_BUFLEN];
 
+    if (!obj)
+        return;
+
     virUUIDFormat(secret->def->uuid, uuidstr);
     virObjectRef(secret);
     virObjectUnlock(secret);
@@ -915,8 +918,7 @@ virSecretLoad(virSecretObjListPtr secrets,
     secret = NULL;
 
  cleanup:
-    if (secret)
-        virSecretObjListRemove(secrets, secret);
+    virSecretObjListRemove(secrets, secret);
     virSecretDefFree(def);
     return ret;
 }
-- 
2.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux