From: Ján Tomko Date: Fri, 30 Nov 2012 14:07:50 +0000 (+0100) Subject: nwfilter: report an error on OOM X-Git-Tag: v0.10.2.2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e78179d0e166717a72d0349fb6ca196fdd68ee7;p=thirdparty%2Flibvirt.git nwfilter: report an error on OOM 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) --- diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index a80bb66e7e..ba148230c7 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -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();