提交 f89c67cf 编写于 作者: J Jim Meyering

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.
上级 dc03ae2c
......@@ -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;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册