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

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



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1254396375 -3600
# Node ID 9489dc2163213c5b630504f00808e34b8d63ef63
# Parent  26708cdf86be4a796a51c7770bab2c18c525671d
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>
---
 tools/python/xen/lowlevel/xs/xs.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -r 26708cdf86be -r 9489dc216321 tools/python/xen/lowlevel/xs/xs.c
--- a/tools/python/xen/lowlevel/xs/xs.c Thu Oct 01 12:25:36 2009 +0100
+++ b/tools/python/xen/lowlevel/xs/xs.c Thu Oct 01 12:26:15 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®.