diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-10-16 21:48:06 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-10-16 21:48:06 (GMT) |
commit | 336680ecead72c4f5481d16c3e6f8458ccb01832 (patch) | |
tree | 4a48c75ce08761cc42f59d50bc356361bc0f2bd9 /Modules/_json.c | |
parent | 865cd640bb3d24210a1c78ed14a7a1819ca74b68 (diff) | |
download | cpython-336680ecead72c4f5481d16c3e6f8458ccb01832.zip cpython-336680ecead72c4f5481d16c3e6f8458ccb01832.tar.gz cpython-336680ecead72c4f5481d16c3e6f8458ccb01832.tar.bz2 |
fix more possible ref leaks in _json and use Py_CLEAR
Diffstat (limited to 'Modules/_json.c')
-rw-r--r-- | Modules/_json.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_json.c b/Modules/_json.c index 437eab0..2e77f1c 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -271,6 +271,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); @@ -372,6 +373,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); @@ -381,8 +383,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); @@ -533,6 +534,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); |