[libvirt] [PATCH v2] admin: Fix memory leak in remoteAdminConnectClose
Erik Skultety
eskultet at redhat.com
Fri Feb 19 07:39:24 UTC 2016
On 18/02/16 17:24, Pavel Hrdina wrote:
> On Thu, Feb 18, 2016 at 05:18:13PM +0100, Erik Skultety wrote:
>> When virt-admin is run with valgrind, this kind of output can be obtained:
>>
>> HEAP SUMMARY:
>> in use at exit: 134,589 bytes in 1,031 blocks
>> total heap usage: 2,667 allocs, 1,636 frees, 496,755 bytes allocated
>>
>> 88 bytes in 1 blocks are definitely lost in loss record 82 of 128
>> at 0x4C2A9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>> by 0x52F6D1F: virAllocVar (viralloc.c:560)
>> by 0x5350268: virObjectNew (virobject.c:193)
>> by 0x53503E0: virObjectLockableNew (virobject.c:219)
>> by 0x4E3BBCB: virAdmConnectNew (datatypes.c:832)
>> by 0x4E38495: virAdmConnectOpen (libvirt-admin.c:209)
>> by 0x10C541: vshAdmConnect (virt-admin.c:107)
>> by 0x10C7B2: vshAdmReconnect (virt-admin.c:163)
>> by 0x10CC7C: cmdConnect (virt-admin.c:298)
>> by 0x110838: vshCommandRun (vsh.c:1224)
>> by 0x10DFD8: main (virt-admin.c:862)
>>
>> LEAK SUMMARY:
>> definitely lost: 88 bytes in 1 blocks
>> indirectly lost: 0 bytes in 0 blocks
>> possibly lost: 0 bytes in 0 blocks
>> still reachable: 134,501 bytes in 1,030 blocks
>> suppressed: 0 bytes in 0 blocks
>>
>> This is because virNetClientSetCloseCallback was being reinitialized
>> incorrectly. By resetting the callbacks in a proper way, the leak is fixed.
>> ---
>> src/admin/admin_remote.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> ACK
>
I pushed the patch, thanks.
Erik
More information about the libvir-list
mailing list