Re: [PATCH 1/3] python: Fix memory leaks on libvirt_virDomainGetSchedulerParameters

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

 



On 12/31/2011 03:29 AM, ajia@xxxxxxxxxx wrote:
> From: Alex Jia <ajia@xxxxxxxxxx>
> 
> Detected by valgrind. Leaks introduced in commit 62094f7 and commit c5cf6e1.
> 

>          key = libvirt_constcharPtrWrap(params[i].field);
>          PyDict_SetItem(info, key, val);
> +        Py_DECREF(key);
> +        Py_DECREF(val);

Can PyDict_SetItem() fail?  If so, shouldn't we be recovering from that
failure by cleaning up memory and returning a proper error, rather than
blindly proceeding on?  We ought to fix all PyDict_SetItem clients in
the same way as part of a global cleanup patch in the python directory,
which will have the side effect of fixing the memory leaks in the process.

-- 
Eric Blake   eblake@xxxxxxxxxx    +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]