[libvirt] [PATCH] virsh: fix memory leak in virsh when starting a guest with invalid fd
Eric Blake
eblake at redhat.com
Thu Feb 20 12:34:30 UTC 2014
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.
>
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140220/8fd9d25e/attachment-0001.sig>
More information about the libvir-list
mailing list