Re: [PATCH]LXC: free dst before lxcDomainAttachDeviceDiskLive return

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

 




> -----Original Message-----
> From: Daniel Veillard [mailto:veillard@xxxxxxxxxx]
> Sent: Thursday, September 26, 2013 4:42 PM
> To: Chen Hanxiao
> Cc: libvir-list@xxxxxxxxxx
> Subject: Re:  [PATCH]LXC: free dst before
> lxcDomainAttachDeviceDiskLive return
> 
> On Thu, Sep 26, 2013 at 02:01:52PM +0800, Chen Hanxiao wrote:
> > From: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
> >
> > free dst before lxcDomainAttachDeviceDiskLive return
> >
> > Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
> >      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@xxxxxxxxxx  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
> http://veillard.com/ | 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]