Discussion:
[Python-3000-checkins] r66943 - in python/branches/py3k: Modules/_json.c
benjamin.peterson
2008-10-16 21:56:24 UTC
Permalink
Author: benjamin.peterson
Date: Thu Oct 16 23:56:24 2008
New Revision: 66943

Log:
Merged revisions 66938,66942 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk

........
r66938 | benjamin.peterson | 2008-10-16 16:27:54 -0500 (Thu, 16 Oct 2008) | 1 line

fix possible ref leak
........
r66942 | benjamin.peterson | 2008-10-16 16:48:06 -0500 (Thu, 16 Oct 2008) | 1 line

fix more possible ref leaks in _json and use Py_CLEAR
........


Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Modules/_json.c

Modified: python/branches/py3k/Modules/_json.c
==============================================================================
--- python/branches/py3k/Modules/_json.c (original)
+++ python/branches/py3k/Modules/_json.c Thu Oct 16 23:56:24 2008
@@ -276,6 +276,7 @@
goto bail;
}
if (PyList_Append(chunks, chunk)) {
+ Py_DECREF(chunk);
goto bail;
}
Py_DECREF(chunk);
@@ -377,6 +378,7 @@
goto bail;
}
if (PyList_Append(chunks, chunk)) {
+ Py_DECREF(chunk);
goto bail;
}
Py_DECREF(chunk);
@@ -386,8 +388,7 @@
if (rval == NULL) {
goto bail;
}
- Py_DECREF(chunks);
- chunks = NULL;
+ Py_CLEAR(chunks);
return Py_BuildValue("(Nn)", rval, end);
bail:
Py_XDECREF(chunks);
@@ -436,6 +437,7 @@
goto bail;
}
if (PyList_Append(chunks, chunk)) {
+ Py_DECREF(chunk);
goto bail;
}
Py_DECREF(chunk);
@@ -537,6 +539,7 @@
goto bail;
}
if (PyList_Append(chunks, chunk)) {
+ Py_DECREF(chunk);
goto bail;
}
Py_DECREF(chunk);
@@ -546,8 +549,7 @@
if (rval == NULL) {
goto bail;
}
- Py_DECREF(chunks);
- chunks = NULL;
+ Py_CLEAR(chunks);
return Py_BuildValue("(Nn)", rval, end);
bail:
Py_XDECREF(chunks);

Loading...