[libvirt] [PATCH] nwfilter: fix a memory leak

Stefan Berger stefanb at us.ibm.com
Fri Aug 13 19:39:40 UTC 2010


libvir-list-bounces at redhat.com wrote on 08/13/2010 03:06:21 PM:


> On 08/13/2010 12:28 PM, Stefan Berger wrote:
> >  Fixing a memory leak.
> > 
> > Signed-off-by: Stefan Berger <stefanb at us.ibm.com>
> > 
> > ---
> >  src/nwfilter/nwfilter_ebiptables_driver.c |    3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > Index: libvirt-acl/src/nwfilter/nwfilter_ebiptables_driver.c
> > ===================================================================
> > --- libvirt-acl.orig/src/nwfilter/nwfilter_ebiptables_driver.c
> > +++ libvirt-acl/src/nwfilter/nwfilter_ebiptables_driver.c
> > @@ -2973,6 +2973,9 @@ static int ebtablesCleanAll(const char *
> >      ebtablesRemoveTmpRootChain(&buf, 0, ifname);
> > 
> >      ebiptablesExecCLI(&buf, &cli_status);
> > +
> > +    virBufferFreeAndReset(&buf);
> > +
> 
> NACK.  ebiptablesExecCLI already frees the buffer whether it succeeds or
> fails; that is, by calling ebiptablesExecCLI, you have given up
> ownership of buf and there is nothing left to free.  What makes you
> think this is a leak?

Valgrind showed it ... strange, I cannot reproduce it now.

  Stefan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100813/f5435d3e/attachment-0001.htm>


More information about the libvir-list mailing list