mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
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.
This commit is contained in:
parent
dc03ae2c6d
commit
f89c67cf19
@ -4,7 +4,7 @@
|
|||||||
* entry points where an automatically generated stub is
|
* entry points where an automatically generated stub is
|
||||||
* unpractical
|
* unpractical
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005, 2007-2009 Red Hat, Inc.
|
* Copyright (C) 2005, 2007-2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* Daniel Veillard <veillard@redhat.com>
|
* Daniel Veillard <veillard@redhat.com>
|
||||||
*/
|
*/
|
||||||
@ -2046,8 +2046,10 @@ libvirt_virConnectBaselineCPU(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
for (i = 0; i < ncpus; i++) {
|
for (i = 0; i < ncpus; i++) {
|
||||||
xmlcpus[i] = PyString_AsString(PyList_GetItem(list, i));
|
xmlcpus[i] = PyString_AsString(PyList_GetItem(list, i));
|
||||||
if (xmlcpus[i] == NULL)
|
if (xmlcpus[i] == NULL) {
|
||||||
|
free(xmlcpus);
|
||||||
return VIR_PY_INT_FAIL;
|
return VIR_PY_INT_FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user