From 69c4600d61fa74c4977d2471a29fb73f0fe5edb0 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 18 Mar 2014 09:20:00 +0100 Subject: [PATCH] setPyVirTypedParameter: free whole return variable on error The @ret value is built in a loop. However, if in one iteration there's an error, we should free all the fields built so far. For instance, if there's an error and the previous item was type of VIR_TYPED_PARAM_STRING we definitely must free it. Signed-off-by: Michal Privoznik --- libvirt-override.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvirt-override.c b/libvirt-override.c index 3765a43..7f746ed 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -259,7 +259,7 @@ setPyVirTypedParameter(PyObject *info, return ret; cleanup: - VIR_FREE(ret); + virTypedParamsFree(ret, size); return NULL; }