[Libosinfo] [PATCH 1/5] loader: fix memory leaks when loading data

Daniel P. Berrange berrange at redhat.com
Wed Oct 7 12:34:47 UTC 2015


On Wed, Oct 07, 2015 at 01:24:48PM +0100, Daniel P. Berrange wrote:
> On Wed, Oct 07, 2015 at 09:24:14AM +0200, Christophe Fergeau wrote:
> > Hey,
> > 
> > On Tue, Oct 06, 2015 at 05:40:59PM +0100, Daniel P. Berrange wrote:
> > > The 'lang' attribute needs to be free'd with xmlFree.
> > > 
> > > The install script config param needs to be unref'd
> > > since when it is added to the install script an extra
> > > ref is taken.
> > > 
> > > The install script avatar needs to be unref'd since
> > > when it is added to the intsall script an extra ref is
> > 
> > s/intsall/install/
> > 
> > > taken.
> > > 
> > > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > > ---
> > >  osinfo/osinfo_loader.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> > > index 4e8f942..0c7ddfb 100644
> > > --- a/osinfo/osinfo_loader.c
> > > +++ b/osinfo/osinfo_loader.c
> > > @@ -342,6 +342,7 @@ static void osinfo_loader_entity(OsinfoLoader *loader,
> > >                              break;
> > 
> > 'lang' will still be leaked when this 'break' is reached.
> > 
> > ACK otherwise.
> 
> Thanks will fix before pushing.

Actually no, it won't be leaked. That break is inside a for() loop,
so it'll simply break out of that inner for() loop and hit the
xmlFree(lang) call that I'm adding.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the Libosinfo mailing list