
On 11/12/2013 06:53 AM, Martin Kletzander wrote:
@@ -2621,7 +2630,8 @@ libvirt_virDomainSnapshotListChildrenNames(PyObject *self ATTRIBUTE_UNUSED, return VIR_PY_NONE; } } - py_retval = PyList_New(c_retval); + if (!(py_retval = PyList_New(c_retval))) + goto cleanup;
This function should follow others and return VIR_PY_NONE, but cleanup path returns py_retval.
Actually, you WANT to return NULL, not VIR_PY_NONE, when PyList_New() fails. Returning NULL is the hint to python to report the OOM exception; returning VIR_PY_NONE is not NULL and therefore silently papers over the exception. Worse, the rest of the libvirt python code treats a return of the python object 'None' as meaning 'the API call failed, dig out the last virError and turn it into a python exception'; but in this case, there is no virError (our failure was not related to a failed C API call). This code rewrite is correct as-is. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org