From: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
Unlock @obj in case of an error too.
Reviewed-by: Bjoern Walk <bwalk(a)linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
---
src/node_device/node_device_driver.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 002c7616f..74507c214 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -282,7 +282,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)
@@ -302,6 +302,10 @@ nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn,
out:
nodeDeviceUnlock();
return dev;
+
+ error:
+ virNodeDeviceObjUnlock(obj);
+ goto out;
}
--
2.11.2