diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index 169a60bd6a0a6e67c31a36f0b29a903ada58c86a..7c2ad907ac7799d2cead4c2cf5ae13cfeb814001 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; }