node_device: Unlock obj in case of an error too

Unlock @obj in case of an error too.

Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
This commit is contained in:
Marc Hartmayer 2017-05-22 08:38:21 +02:00 committed by John Ferlan
parent 3e69217953
commit a9b98ecf4e

View File

@ -284,7 +284,7 @@ nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
STREQ(cap->data.scsi_host.wwpn, wwpn)) {
if (virNodeDeviceLookupSCSIHostByWWNEnsureACL(conn, obj->def) < 0)
goto out;
goto error;
if ((dev = virGetNodeDevice(conn, obj->def->name))) {
if (VIR_STRDUP(dev->parent, obj->def->parent) < 0) {
@ -306,6 +306,10 @@ nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
out:
nodeDeviceUnlock();
return dev;
error:
virNodeDeviceObjUnlock(obj);
goto out;
}