storage_driver: Unlock object on ACL fail in storagePoolLookupByTargetPath

'virStoragePoolObjListSearch' returns a locked and refed object, thus we
must release it on ACL permission failure.

Fixes: 7aa0e8c0cb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1984318
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-07-21 11:22:25 +02:00
parent af013aa14c
commit 447f69dec4

View File

@ -1738,8 +1738,10 @@ storagePoolLookupByTargetPath(virConnectPtr conn,
storagePoolLookupByTargetPathCallback,
cleanpath))) {
def = virStoragePoolObjGetDef(obj);
if (virStoragePoolLookupByTargetPathEnsureACL(conn, def) < 0)
if (virStoragePoolLookupByTargetPathEnsureACL(conn, def) < 0) {
virStoragePoolObjEndAPI(&obj);
return NULL;
}
pool = virGetStoragePool(conn, def->name, def->uuid, NULL, NULL);
virStoragePoolObjEndAPI(&obj);