[libvirt] [PATCH] Fix destroy command memory leaks

Richard W.M. Jones rjones at redhat.com
Tue May 20 09:48:27 UTC 2008


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.

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

Anyway the calls should be changed to do what they are supposed to do.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the libvir-list mailing list