[libvirt] [PATCH]LXC: free dst before lxcDomainAttachDeviceDiskLive return
Chen Hanxiao
chenhanxiao at cn.fujitsu.com
Thu Sep 26 09:04:07 UTC 2013
> -----Original Message-----
> From: Daniel Veillard [mailto:veillard at redhat.com]
> Sent: Thursday, September 26, 2013 4:42 PM
> To: Chen Hanxiao
> Cc: libvir-list at redhat.com
> Subject: Re: [libvirt] [PATCH]LXC: free dst before
> lxcDomainAttachDeviceDiskLive return
>
> On Thu, Sep 26, 2013 at 02:01:52PM +0800, Chen Hanxiao wrote:
> > From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> >
> > free dst before lxcDomainAttachDeviceDiskLive return
> >
> > Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> > virDomainAuditDisk(vm, NULL, def->src, "attach", ret == 0);
> > if (dst && created && ret < 0)
> > unlink(dst);
> > + VIR_FREE(dst);
> > return ret;
> > }
>
> Hum, it is a bit complex as the allocated dst is saved in
> the definition a few lines earlier:
>
> /* Labelling normally operates on src, but we need
> * to actally label the dst here, so hack the config */
> def->src = dst;
>
> and then in cleanup it's overriden again with the value saved at the
> start of the function:
>
> cleanup:
> def->src = tmpsrc;
> virDomainAuditDisk(vm, NULL, def->src, "attach", ret == 0);
>
> the leak is real and that free certainly need to be added but maybe
> there is a bit of cleanup needed rather than just adding the VIR_FREE()
>
This scenario is a little complex for me. As my investigation, VIR_FREE()
can work
in some cases.
> I will let someone with more knowledge of that code part decide :-)
Thanks for any help :)
>
> Daniel
>
>
> --
> Daniel Veillard | Open Source and Standards, Red Hat
> veillard at redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
> http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list