hadoop-zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From he...@apache.org
Subject svn commit: r987982 - in /hadoop/zookeeper/trunk: CHANGES.txt src/contrib/zkpython/src/c/zookeeper.c
Date Mon, 23 Aug 2010 02:53:54 GMT
Author: henry
Date: Mon Aug 23 02:53:53 2010
New Revision: 987982

URL: http://svn.apache.org/viewvc?rev=987982&view=rev
Log:
ZOOKEEPER-792: zkpython memory leak (Lei Zhang via henryr)

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=987982&r1=987981&r2=987982&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Mon Aug 23 02:53:53 2010
@@ -78,6 +78,8 @@ BUGFIXES: 
   ZOOKEEPER-795. eventThread isn't shutdown after a connection 
   "session expired" event coming (Sergey Doroshenko and Ben via mahadev)
 
+  ZOOKEEPER-792. zkpython memory leak (Lei Zhang via henryr)
+
 IMPROVEMENTS:
   ZOOKEEPER-724. Improve junit test integration - log harness information 
   (phunt via mahadev)

Modified: hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c?rev=987982&r1=987981&r2=987982&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c (original)
+++ hadoop/zookeeper/trunk/src/contrib/zkpython/src/c/zookeeper.c Mon Aug 23 02:53:53 2010
@@ -1011,6 +1011,7 @@ static PyObject *pyzoo_create(PyObject *
   }
   zhandle_t *zh = zhandles[zkhid];
   int err = zoo_create(zh, path, values, valuelen, &aclv, flags, realbuf, maxbuf_len);
+  free_acls(&aclv);
   if (err != ZOK) {
     PyErr_SetString(err_to_exception(err), zerror(err));
     return NULL;
@@ -1183,7 +1184,7 @@ static PyObject *pyzoo_get(PyObject *sel
   }
   buffer = malloc(sizeof(char)*buffer_len);
   if (buffer == NULL) {
-    free(pw);
+    free_pywatcher(pw);
     PyErr_SetString(PyExc_MemoryError, "buffer could not be allocated in pyzoo_get");
     return NULL;
   }
@@ -1193,14 +1194,17 @@ static PyObject *pyzoo_get(PyObject *sel
                      pw, buffer, 
                      &buffer_len, &stat);
  
-  PyObject *stat_dict = build_stat( &stat );
-
   if (err != ZOK) {
     PyErr_SetString(err_to_exception(err), zerror(err));
+    free_pywatcher(pw);
+    free(buffer);
     return NULL;
   }
+
+  PyObject *stat_dict = build_stat( &stat );
   PyObject *ret = Py_BuildValue( "(s#,N)", buffer,buffer_len, stat_dict );
   free(buffer);
+
   return ret;
 }
 



Mime
View raw message