diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-10-16 21:56:24 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-10-16 21:56:24 (GMT) |
commit | 8e8c2152fbfb1d48929d9be8222cb2f73b562060 (patch) | |
tree | fb18651e439e7f0e80f7741a067d17eeb31ce661 /Modules | |
parent | a13d475901553b4a0ec7ed679ce2eac4598b557f (diff) | |
download | cpython-8e8c2152fbfb1d48929d9be8222cb2f73b562060.zip cpython-8e8c2152fbfb1d48929d9be8222cb2f73b562060.tar.gz cpython-8e8c2152fbfb1d48929d9be8222cb2f73b562060.tar.bz2 |
Merged revisions 66938,66942 via svnmerge from
svn+ssh://pythondev@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
........
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_json.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/_json.c b/Modules/_json.c index 0068bda..9c35f64 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -276,6 +276,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -377,6 +378,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -386,8 +388,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) 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 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict) goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -537,6 +539,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict) goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -546,8 +549,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict) if (rval == NULL) { goto bail; } - Py_DECREF(chunks); - chunks = NULL; + Py_CLEAR(chunks); return Py_BuildValue("(Nn)", rval, end); bail: Py_XDECREF(chunks); |