From: Benjamin Peterson Date: Thu, 16 Oct 2008 21:27:54 +0000 (+0000) Subject: fix possible ref leak X-Git-Tag: v2.7a1~2727 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87e6ad290b086c2d95ef9eb443e175c24b00ae94;p=thirdparty%2FPython%2Fcpython.git fix possible ref leak --- diff --git a/Modules/_json.c b/Modules/_json.c index 832b1ff627e3..437eab0eae33 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -431,6 +431,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); @@ -541,8 +542,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);