Run VIR_FREE only for non-NULL pointers. --- src/network/bridge_driver.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index b0834ae..f2857b4 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -534,34 +534,34 @@ dhcpStartDhcpDaemon(virNetworkObjPtr network) if (!VIR_SOCKET_IS_FAMILY(&network->def->ipAddress, AF_INET)) { networkReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot start dhcp daemon without IPv4 address for server")); - goto cleanup; + goto cleanup2; } if ((err = virFileMakePath(NETWORK_PID_DIR)) != 0) { virReportSystemError(err, _("cannot create directory %s"), NETWORK_PID_DIR); - goto cleanup; + goto cleanup2; } if ((err = virFileMakePath(NETWORK_STATE_DIR)) != 0) { virReportSystemError(err, _("cannot create directory %s"), NETWORK_STATE_DIR); - goto cleanup; + goto cleanup2; } if (!(pidfile = virFilePid(NETWORK_PID_DIR, network->def->name))) { virReportOOMError(); - goto cleanup; + goto cleanup2; } cmd = virCommandNew(DNSMASQ); if (networkBuildDnsmasqArgv(network, pidfile, cmd) < 0) { - goto cleanup; + goto cleanup1; } if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + goto cleanup1; /* * There really is no race here - when dnsmasq daemonizes, its @@ -573,12 +573,13 @@ dhcpStartDhcpDaemon(virNetworkObjPtr network) if (virFileReadPid(NETWORK_PID_DIR, network->def->name, &network->dnsmasqPid) < 0) - goto cleanup; + goto cleanup1; ret = 0; -cleanup: +cleanup1: VIR_FREE(pidfile); virCommandFree(cmd); +cleanup2: return ret; } -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list