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

Re: [libvirt] [PATCH] Fix destroy command memory leaks

On Tue, May 20, 2008 at 10:48:27AM +0100, Richard W.M. Jones wrote:
> On Mon, May 19, 2008 at 05:30:33PM -0400, Cole Robinson wrote:
> > Some pieces of libvirt currently assume that the vir*Destroy
> > functions will free the passed object upon success. In
> > practice none of the current drivers seem to do this,
> > resulting in memory leaks.
> > 
> > The attached patch fixes the leaks I could find, as well as
> > changes the comments for virDomainDestroy and virNetworkDestroy
> > in libvirt.c to reflect reality. I also added a couple debug
> > statements to hash.c where domain reference counts can be
> > printed as they are changed.
> For virDomainDestroy & virNetworkDestroy & virStoragePoolDestroy, I
> have code which assumes that these calls also free the C structure.
> AFAIK this has always been the supposedly correct behaviour of these
> calls.

No, the docs are wrong. Free'ing after destroy is not correct because the
object still exists in an active state and can be used.

> Maybe this was broken when Dan changed hash.c a while back?

I don't believe so. This has always been the behaviour AFAIR.
> Anyway the calls should be changed to do what they are supposed to do.

No change needed then :-)

|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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