]> xenbits.xensource.com Git - libvirt.git/commitdiff
Do not call nodeStateCleanup on early initialization error
authorJán Tomko <jtomko@redhat.com>
Fri, 3 Jun 2016 10:30:53 +0000 (12:30 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 7 Jun 2016 08:51:36 +0000 (10:51 +0200)
If we have not allocated driver yet, there is nothing to cleanup.

src/node_device/node_device_udev.c

index 1e11afe1286af2f8ce996350cae6fa2639ef979b..c2f503ddebf8fbe75d6c452a75bde968cbe40991 100644 (file)
@@ -1709,21 +1709,21 @@ static int nodeStateInitialize(bool privileged,
     int ret = -1;
 
     if (VIR_ALLOC(priv) < 0)
-        goto out;
+        return -1;
 
     priv->watch = -1;
     priv->privileged = privileged;
 
     if (VIR_ALLOC(driver) < 0) {
         VIR_FREE(priv);
-        goto out;
+        return -1;
     }
 
     if (virMutexInit(&driver->lock) < 0) {
         VIR_ERROR(_("Failed to initialize mutex for driver"));
         VIR_FREE(priv);
         VIR_FREE(driver);
-        goto out;
+        return -1;
     }
 
     nodeDeviceLock();
@@ -1785,7 +1785,6 @@ static int nodeStateInitialize(bool privileged,
  out_unlock:
     nodeDeviceUnlock();
 
- out:
     if (ret == -1)
         nodeStateCleanup();
     return ret;