Author: henry Date: Mon Aug 23 02:58:16 2010 New Revision: 987984 URL: http://svn.apache.org/viewvc?rev=987984&view=rev Log: ZOOKEEPER-792: zkpython memory leak (Lei Zhang via henryr)
Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c Modified: hadoop/zookeeper/branches/branch-3.3/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/CHANGES.txt?rev=987984&r1=987983&r2=987984&view=diff ============================================================================== --- hadoop/zookeeper/branches/branch-3.3/CHANGES.txt (original) +++ hadoop/zookeeper/branches/branch-3.3/CHANGES.txt Mon Aug 23 02:58:16 2010 @@ -14,6 +14,8 @@ BUGFIXES: ZOOKEEPER-795. eventThread isn't shutdown after a connection "session expired" event coming (sergey doroshenko via breed) + ZOOKEEPER-792. zkpython memory leak (Lei Zhang via henryr) + IMPROVEMENTS: ZOOKEEPER-789. Improve FLE log messages (flavio via phunt) Modified: hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c?rev=987984&r1=987983&r2=987984&view=diff ============================================================================== --- hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c (original) +++ hadoop/zookeeper/branches/branch-3.3/src/contrib/zkpython/src/c/zookeeper.c Mon Aug 23 02:58:16 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; }