summaryrefslogtreecommitdiffstats
path: root/libvirt-override.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-02-16 08:07:38 +0100
committerJim Meyering <meyering@redhat.com>2010-02-16 17:49:05 +0100
commit84bc8ee00e945223bebc4376aaf24fc2d96390c2 (patch)
treecb68b5b8b2ca15d4e8cc43768e557e6f74706dd2 /libvirt-override.c
parentbe6735de04f6f1e067553d0c96bdedf3bfe759bf (diff)
downloadlibvirt-python-split-84bc8ee00e945223bebc4376aaf24fc2d96390c2.tar.gz
libvirt-python-split-84bc8ee00e945223bebc4376aaf24fc2d96390c2.tar.xz
libvirt-python-split-84bc8ee00e945223bebc4376aaf24fc2d96390c2.zip
libvirt-override.c: avoid a leak upon call with invalid argument
* python/libvirt-override.c (libvirt_virConnectBaselineCPU): Don't leak the xmlcpus buffer upon encountering a non-string list element.
Diffstat (limited to 'libvirt-override.c')
-rw-r--r--libvirt-override.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libvirt-override.c b/libvirt-override.c
index a71766a..2447ad7 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -4,7 +4,7 @@
* entry points where an automatically generated stub is
* unpractical
*
- * Copyright (C) 2005, 2007-2009 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2010 Red Hat, Inc.
*
* Daniel Veillard <veillard@redhat.com>
*/
@@ -2046,8 +2046,10 @@ libvirt_virConnectBaselineCPU(PyObject *self ATTRIBUTE_UNUSED,
for (i = 0; i < ncpus; i++) {
xmlcpus[i] = PyString_AsString(PyList_GetItem(list, i));
- if (xmlcpus[i] == NULL)
+ if (xmlcpus[i] == NULL) {
+ free(xmlcpus);
return VIR_PY_INT_FAIL;
+ }
}
}