From 87e6ad290b086c2d95ef9eb443e175c24b00ae94 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 16 Oct 2008 21:27:54 +0000 Subject: [PATCH] fix possible ref leak --- Modules/_json.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/_json.c b/Modules/_json.c index 832b1ff627e..437eab0eae3 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);