From: Laine Stump Date: Mon, 19 Mar 2012 03:57:50 +0000 (-0400) Subject: conf: return immediately on error in dhcp host element X-Git-Tag: v0.9.11-rc1~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43d635caf30988b28f1367b97041fc2f28eabec4;p=thirdparty%2Flibvirt.git conf: return immediately on error in dhcp host element If an error was encountered parsing a dhcp host entry mac address or name, parsing would continue and log a less descriptive error that might make it more difficult to notice the true nature of the problem. This patch returns immediately on logging the first error. --- diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 0333141305..4341f11073 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -430,13 +430,16 @@ virNetworkDHCPRangeDefParseXML(const char *networkName, _("Cannot parse MAC address '%s' in network '%s'"), mac, networkName); VIR_FREE(mac); + return -1; } name = virXMLPropString(cur, "name"); if ((name != NULL) && (!c_isalpha(name[0]))) { virNetworkReportError(VIR_ERR_INTERNAL_ERROR, _("Cannot use name address '%s' in network '%s'"), name, networkName); + VIR_FREE(mac); VIR_FREE(name); + return -1; } /* * You need at least one MAC address or one host name