On Thu, Nov 07, 2013 at 03:44:23PM +0100, Giuseppe Scrivano wrote:
Signed-off-by: Giuseppe Scrivano <gscrivan(a)redhat.com>
---
python/libvirt-override.c | 88 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 70 insertions(+), 18 deletions(-)
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 83bca94..3b902bc 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
[...]
@@ -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.
for (i = 0; i < c_retval; i++) {
if ((pyobj_snap = libvirt_constcharPtrWrap(names[i])) == NULL) {
[...]
@@ -3207,11 +3235,14 @@ libvirt_virNodeGetCellsFreeMemory(PyObject
*self ATTRIBUTE_UNUSED, PyObject *arg
VIR_FREE(freeMems);
return VIR_PY_NONE;
}
- py_retval = PyList_New(c_retval);
+ if (!(py_retval = PyList_New(c_retval)))
+ goto cleanup;
+
ditto
for (i = 0; i < c_retval; i++) {
PyList_SET_ITEM(py_retval, i,
libvirt_longlongWrap((long long) freeMems[i]));
}
+cleanup:
VIR_FREE(freeMems);
return py_retval;
}
ACK with those two places fixed (don't forget to free the names in a
loop in the first hunk).
Martin