[libvirt] [PATCH] virNetlinkDumpCommand: Don't leak response buffer

Michal Privoznik mprivozn at redhat.com
Mon Mar 19 09:47:48 UTC 2018


On 03/19/2018 10:13 AM, Erik Skultety wrote:
> On Mon, Mar 19, 2018 at 07:47:08AM +0100, Michal Privoznik wrote:
>> ==16451== 32,768 bytes in 2 blocks are definitely lost in loss record 1,007 of 1,013
>> ==16451==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
>> ==16451==    by 0x7CADB40: nl_recv (in /usr/lib64/libnl-3.so.200.23.0)
>> ==16451==    by 0x532DFAC: virNetlinkDumpCommand (virnetlink.c:363)
>> ==16451==    by 0x53236AE: virNetDevIPCheckIPv6Forwarding (virnetdevip.c:641)
>> ==16451==    by 0xE3E4A1A: networkStartNetworkVirtual (bridge_driver.c:2490)
>> ==16451==    by 0xE3E55F5: networkStartNetwork (bridge_driver.c:2832)
>> ==16451==    by 0xE3DFFE5: networkAutostartConfig (bridge_driver.c:531)
>> ==16451==    by 0x53F47E0: virNetworkObjListForEachHelper (virnetworkobj.c:1412)
>> ==16451==    by 0x52FE69F: virHashForEach (virhash.c:606)
>> ==16451==    by 0x53F4857: virNetworkObjListForEach (virnetworkobj.c:1439)
>> ==16451==    by 0xE3E0BF4: networkStateAutoStart (bridge_driver.c:808)
>> ==16451==    by 0x55689CE: virStateInitialize (libvirt.c:758)
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>  src/util/virnetlink.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
>> index 0e281b06b8..955f1558ee 100644
>> --- a/src/util/virnetlink.c
>> +++ b/src/util/virnetlink.c
>> @@ -360,6 +360,7 @@ virNetlinkDumpCommand(struct nl_msg *nl_msg,
>>          goto cleanup;
>>
>>      while (!end) {
>> +        VIR_FREE(resp);
> 
> Personally, I'd put this at the end of the loop rather than at the beginning
> but that's a matter of taste, function-wise it doesn't matter, so

Okay, I've moved it at the end of the loop body and pushed. Thanks.

Michal




More information about the libvir-list mailing list