]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nwfilter: report an error on OOM
authorJán Tomko <jtomko@redhat.com>
Fri, 30 Nov 2012 14:07:50 +0000 (15:07 +0100)
committerCole Robinson <crobinso@redhat.com>
Sun, 9 Dec 2012 21:53:41 +0000 (16:53 -0500)
Also removed some unreachable code found by coverity:
libvirt-0.10.2/src/nwfilter/nwfilter_driver.c:259: unreachable: This
code cannot be reached: "nwfilterDriverUnlock(driver...".
(cherry picked from commit 4f9af0857c1547d19610e5c59efe45a8d847b67f)

src/nwfilter/nwfilter_driver.c

index a80bb66e7e2fa49f215877b2ab8fd774908fd8f0..ba148230c7f4a50d2de940d636c5d28304de1d6a 100644 (file)
@@ -174,8 +174,10 @@ nwfilterDriverStartup(int privileged)
     sysbus = virDBusGetSystemBus();
 #endif /* HAVE_DBUS */
 
-    if (VIR_ALLOC(driverState) < 0)
-        goto alloc_err_exit;
+    if (VIR_ALLOC(driverState) < 0) {
+        virReportOOMError();
+        return -1;
+    }
 
     if (virMutexInit(&driverState->lock) < 0)
         goto err_free_driverstate;
@@ -247,11 +249,8 @@ error:
     nwfilterDriverUnlock(driverState);
     nwfilterDriverShutdown();
 
-alloc_err_exit:
     return -1;
 
-    nwfilterDriverUnlock(driverState);
-
 err_techdrivers_shutdown:
     virNWFilterTechDriversShutdown();
     virNWFilterDHCPSnoopShutdown();