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 <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2017-04-25 09:17:22 -04:00
parent 6f8c858c74
commit 6de89f33fa

View File

@ -298,6 +298,9 @@ virSecretObjListRemove(virSecretObjListPtr secrets,
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
if (!obj)
return;
virUUIDFormat(secret->def->uuid, uuidstr); virUUIDFormat(secret->def->uuid, uuidstr);
virObjectRef(secret); virObjectRef(secret);
virObjectUnlock(secret); virObjectUnlock(secret);
@ -915,7 +918,6 @@ virSecretLoad(virSecretObjListPtr secrets,
secret = NULL; secret = NULL;
cleanup: cleanup:
if (secret)
virSecretObjListRemove(secrets, secret); virSecretObjListRemove(secrets, secret);
virSecretDefFree(def); virSecretDefFree(def);
return ret; return ret;