]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fix possible ref leak
authorBenjamin Peterson <benjamin@python.org>
Thu, 16 Oct 2008 21:27:54 +0000 (21:27 +0000)
committerBenjamin Peterson <benjamin@python.org>
Thu, 16 Oct 2008 21:27:54 +0000 (21:27 +0000)
Modules/_json.c

index 832b1ff627e3582cce9ffbe7dbfcbf106b9d44d0..437eab0eae3322712e3ee14e8b851a719f264031 100644 (file)
@@ -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);