[libvirt] [PATCH] conf: fix memory leak of class_id bitmap
Eric Blake
eblake at redhat.com
Wed Mar 27 17:45:49 UTC 2013
On 03/27/2013 09:35 AM, Guannan Ren wrote:
> When libvirtd loads active network configs from network state directory,
> it should release the class_id memory block which was allocated
> at the time of loading xml from network config directory.
> virBitmapParse will create a new memory block of bitmap class_id which
> causes a memory leak.
>
> This happens when at least one virtual network is active before.
>
> class_id = virXPathString("string(./class_id[1]/@bitmap)", ctxt);
> - if (class_id &&
> - virBitmapParse(class_id, 0,
> + if (class_id) {
> + virBitmapFree(net->class_id);
> + if (virBitmapParse(class_id, 0,
> &net->class_id, CLASS_ID_BITMAP_SIZE) < 0) {
Indentation is off on this line as a result.
ACK, and worth pushing for 1.0.4.
--
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: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130327/026a902a/attachment-0001.sig>
More information about the libvir-list
mailing list