Re: [PATCH] virsh: fix memory leak in virsh when starting a guest with invalid fd

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

 



----- Original Message -----
> On 02/20/2014 02:29 AM, Jincheng Miao wrote:
> > When start a guest with --pass-fd, if the argument of --pass-fd is invalid,
> > virsh will exit, but doesn't free the variable 'dom'.
> > 
> 
> > +++ b/tools/virsh-domain.c
> > @@ -3428,11 +3428,11 @@ cmdStart(vshControl *ctl, const vshCmd *cmd)
> >      if (virDomainGetID(dom) != (unsigned int)-1) {
> >          vshError(ctl, "%s", _("Domain is already active"));
> >          virDomainFree(dom);
> > -        return false;
> > +        goto cleanup;
> >      }
> 
> As is, this change ends up with a double-free calling virDomainFree(dom)
> twice.  Delete the one here, and let the cleanup label handle it instead.

Sorry, I've forget to delete this virDomainFree. Yes, my original meaning
is let the cleanup label handle it. 
Thanks for your review.

> 
> >  
> >      if (cmdStartGetFDs(ctl, cmd, &nfds, &fds) < 0)
> > -        return false;
> > +        goto cleanup;
> 
> at which point this is also correct.  I'll push the amended patch shortly.
> 
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> 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]