On 10/21/2010 03:14 PM, Eric Blake wrote:
> +++ b/src/util/dnsmasq.c
> @@ -76,23 +76,28 @@ hostsfileFree(dnsmasqHostsfile *hostsfile)
> static int
> hostsfileAdd(dnsmasqHostsfile *hostsfile,
> const char *mac,
> - const char *ip,
> + virSocketAddr *ip,
> const char *name)
> {
> + char *ipstr;
> if (VIR_REALLOC_N(hostsfile->hosts, hostsfile->nhosts + 1)< 0)
> goto alloc_error;
>
...
> @@ -100,7 +105,7 @@ hostsfileAdd(dnsmasqHostsfile *hostsfile,
>
> alloc_error:
> virReportOOMError();
> -
> + VIR_FREE(ipstr);
Ouch - freeing uninitialized memory.
Oops - you didn't fix that. So I'm pushing this under the obvious rule:
diff --git i/src/util/dnsmasq.c w/src/util/dnsmasq.c
index 2cb25bf..3c0506c 100644
--- i/src/util/dnsmasq.c
+++ w/src/util/dnsmasq.c
@@ -79,7 +79,7 @@ hostsfileAdd(dnsmasqHostsfile *hostsfile,
virSocketAddr *ip,
const char *name)
{
- char *ipstr;
+ char *ipstr = NULL;
if (VIR_REALLOC_N(hostsfile->hosts, hostsfile->nhosts + 1) < 0)
goto alloc_error;
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org