[libvirt] [PATCH] Improve error reporting when parsing dhcp info for virtual networks
Laine Stump
laine at laine.org
Wed Jan 5 17:01:29 UTC 2011
On 01/05/2011 11:26 AM, Eric Blake wrote:
> On 01/04/2011 11:14 PM, Laine Stump wrote:
>> This is partially in response to
>>
>> https://bugzilla.redhat.com/show_bug.cgi?id=653300
>>
>> The crash in that report was coincidentally fixed when we switched
>> from using inet_pton() to using virSocketParseAddr(), but the absence
>> of an ip address in a dhcp static host definition was still silently
>> ignored (and that entry discarded from the saved XML). This patch
>> turns that into a logged failure; likewise if the entry has neither a
>> mac address nor a name attribute (the entry is useless without at
>> least one of those, plus an ip address).
>> /*
>> * You need at least one MAC address or one host name
>> */
>> if ((mac == NULL)&& (name == NULL)) {
>> + virNetworkReportError(VIR_ERR_XML_ERROR,
>> + _("Static host definition in network '%s' must have mac or name attribute"),
>> + networkName);
>> VIR_FREE(mac);
>> VIR_FREE(name);
> These two frees are pointless, given that you can only get here if both
> variables are NULL. (might have been my fault in a previous patch,
Nope. git blame says it's been there since the day support for static
dhcp hosts was added, so you're off the hook ;-)
> but
> we should clean it up now while touching it again).
>
> ACK with that nit fixed.
Thanks. pushed with your suggested change.
More information about the libvir-list
mailing list