[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.4-testing] Fix memory leak in libxenstore python bindings



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1254410220 -3600
# Node ID 123e6ca38b5c4ca7e7baf5b4d005df1adb9d84e3
# Parent  9ea1640248e78065851e4098f94a4a139fb5524e
Fix memory leak in libxenstore python bindings

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.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
xen-unstable changeset:   20266:9489dc216321
xen-unstable date:        Thu Oct 01 12:26:15 2009 +0100
---
 tools/python/xen/lowlevel/xs/xs.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -r 9ea1640248e7 -r 123e6ca38b5c tools/python/xen/lowlevel/xs/xs.c
--- a/tools/python/xen/lowlevel/xs/xs.c Thu Oct 01 16:16:39 2009 +0100
+++ b/tools/python/xen/lowlevel/xs/xs.c Thu Oct 01 16:17:00 2009 +0100
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.