From f89c67cf19b1588453779fdea841287448f54b6a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 16 Feb 2010 08:07:38 +0100 Subject: [PATCH] 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. --- python/libvirt-override.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/libvirt-override.c b/python/libvirt-override.c index a71766a593..2447ad7052 100644 --- a/python/libvirt-override.c +++ b/python/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 */ @@ -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; + } } } -- GitLab