Skip to contentSkip to conversation

Fix memory leak in libxenstore python bindings

PATCH New Jiri Denemark 1 participant 1 message Sep 30, 2009 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix memory leak in libxenstore python bindings

Hi,

Temporary tuple0 python object was not freed at the end of xspy_set_permissions() in case no error occurred. To reduce code duplication, this path reuses the cleanup code.

tools/python/xen/lowlevel/xs/xs.c +3 -3
diff -r 6472342c8ab0 tools/python/xen/lowlevel/xs/xs.c
@@ -324,6 +324,7 @@ static PyObject *xspy_set_permissions(Xs
 
     xs_transaction_t th;
     char *thstr;
+    PyObject *ret = NULL;
 
     if (!xh)
         goto exit;
@@ -380,14 +381,13 @@ static PyObject *xspy_set_permissions(Xs
         goto exit;
     }
 
-    free(xsperms);
     Py_INCREF(Py_None);
-    return Py_None;
+    ret = Py_None;
 
  exit:
     Py_XDECREF(tuple0);
     free(xsperms);
-    return NULL;
+    return ret;
 }
 
 #define xspy_watch_doc "\n"						\

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel