]> xenbits.xensource.com Git - libvirt.git/commitdiff
nodedev: Add check for NULL obj before call Unlock
authorJohn Ferlan <jferlan@redhat.com>
Wed, 28 Jun 2017 10:54:05 +0000 (06:54 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 28 Jun 2017 13:03:07 +0000 (09:03 -0400)
Commit id '95ea171b' was a bit too aggressive in removing the if (obj)
check since cleanup is reachable after Unlock and obj = NULL.

src/node_device/node_device_driver.c

index bc5c0e50ec15b2448187176a63b0157542eb0b97..5bf202e3f6f7d1fd6365b2369ed77bd106bb2604 100644 (file)
@@ -650,7 +650,8 @@ nodeDeviceDestroy(virNodeDevicePtr dev)
 
  cleanup:
     nodeDeviceUnlock();
-    virNodeDeviceObjUnlock(obj);
+    if (obj)
+        virNodeDeviceObjUnlock(obj);
     VIR_FREE(wwnn);
     VIR_FREE(wwpn);
     return ret;