[libvirt] [PATCH] Plug leak in virCgroupMoveTask

Peter Krempa pkrempa at redhat.com
Wed Jun 26 13:15:31 UTC 2013


On 06/26/13 15:09, Ján Tomko wrote:
> We only break out of the while loop if *content is an empty string.
> However the buffer has been allocated to BUFSIZ + 1 (8193 in my case),
> but it gets overwritten in the next for iteration.
>
> Move VIR_FREE right before we overwrite it to avoid the leak.
>
> ==5777== 16,386 bytes in 2 blocks are definitely lost in loss record 1,022 of 1,027
> ==5777==    by 0x5296E28: virReallocN (viralloc.c:184)
> ==5777==    by 0x52B0C66: virFileReadLimFD (virfile.c:1137)
> ==5777==    by 0x52B0E1A: virFileReadAll (virfile.c:1199)
> ==5777==    by 0x529B092: virCgroupGetValueStr (vircgroup.c:534)
> ==5777==    by 0x529AF64: virCgroupMoveTask (vircgroup.c:1079)
>
> Introduced by 83e4c77.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=978352
> ---
>   src/util/vircgroup.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>

ACK.

Peter




More information about the libvir-list mailing list