]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: return immediately on error in dhcp host element
authorLaine Stump <laine@laine.org>
Mon, 19 Mar 2012 03:57:50 +0000 (23:57 -0400)
committerLaine Stump <laine@laine.org>
Tue, 20 Mar 2012 00:33:30 +0000 (20:33 -0400)
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.

src/conf/network_conf.c

index 033314130569b57931e309ce267d1c80c56ce4e7..4341f110733410a8fb33e27070e3ef7638d29e05 100644 (file)
@@ -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