From: John Ferlan Date: Tue, 25 Apr 2017 13:17:22 +0000 (-0400) Subject: secret: Add NULL obj check to virSecretObjListRemove X-Git-Tag: v3.3.0-rc1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6de89f33fa9e68650f3eb7ce49896fd6a7d935ad;p=thirdparty%2Flibvirt.git secret: Add NULL obj check to virSecretObjListRemove Rather than have the caller check if !obj before calling, just check in the function for !obj and return. Signed-off-by: John Ferlan --- diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index 169a60bd6a..7c2ad907ac 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; }