Re: [PATCH] Convert virNetwork to use virSocketAddr everywhere

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]