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

Re: [libvirt] [PATCH] conf: fix memory leak of class_id bitmap

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

Attachment: signature.asc
Description: OpenPGP digital signature

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