[libvirt] [PATCH 1/3] python: Fix memory leaks on libvirt_virDomainGetSchedulerParameters
Alex Jia
ajia at redhat.com
Tue Jan 3 16:05:39 UTC 2012
Hi Eric,
Thanks for your comment, the PyDict_SetItem still works well for me, I can get a
expected result by calling related python binding API, Doesn't it work for you?
In addition, you mean we need a cleanup patch to fix all of memory leaks issues,
right? or need to define a global cleanup function to do this? For side effect,
in fact, I can't understand this now :( maybe, you may give me more details.
Thanks a lot!
Alex
----- Original Message -----
From: "Eric Blake" <eblake at redhat.com>
To: ajia at redhat.com
Cc: libvir-list at redhat.com
Sent: Sunday, January 1, 2012 7:52:21 AM
Subject: Re: [libvirt] [PATCH 1/3] python: Fix memory leaks on libvirt_virDomainGetSchedulerParameters
On 12/31/2011 03:29 AM, ajia at redhat.com wrote:
> From: Alex Jia <ajia at redhat.com>
>
> 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 at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list