Re: [PATCH] nodedev: fix pci express memory leak

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

 



On 07/22/2014 11:20 PM, Martin Kletzander wrote:
> On Tue, Jul 22, 2014 at 10:42:29PM -0600, Eric Blake wrote:
>> Leak introduced in commit 16ebf10f (v1.2.6), detected by valgrind:
>>
>> ==9816== 216 (96 direct, 120 indirect) bytes in 6 blocks are
>> definitely lost in loss record 665 of 821
>> ==9816==    at 0x4A081D4: calloc (in
>> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>> ==9816==    by 0x50836FB: virAlloc (viralloc.c:144)
>> ==9816==    by 0x1DBDBE27: udevProcessPCI (node_device_udev.c:546)
>> ==9816==    by 0x1DBDD79D: udevGetDeviceDetails (node_device_udev.c:1293)
>>
>> While at it, fix switch statements to be a bit more vocal if we forget
>> some cases when adding new devices.
>>
>> * src/conf/node_device_conf.c (virNodeDeviceDefFormat)
>> (virNodeDevCapsDefParseXML): Drop default case.
>> (virNodeDevCapsDefFree): Likewise, and clear pci_express under pci
>> case.
>>
>> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
>> ---
>>
>> I could be persuaded to split this into two patches.
>>
> 
> That would be nice, now that you've mentioned it :)

Will do, in v2.


>>         VIR_FREE(data->pci_dev.iommuGroupDevices);
>> +        VIR_FREE(data->pci_dev.pci_express);
> 
> There should be data->pci_dev.pci_express->link_{sta,cap} free()'d too.
> 
> ACK with that changed.

Then node_device_udev.c has the same bug in udevProcessPCI.  All the
more reason for me to respin.

> 
> Martin

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]