Commit 87e6ad29 authored by Benjamin Peterson's avatar Benjamin Peterson

fix possible ref leak

parent 0a6b28ae
...@@ -431,6 +431,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict) ...@@ -431,6 +431,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict)
goto bail; goto bail;
} }
if (PyList_Append(chunks, chunk)) { if (PyList_Append(chunks, chunk)) {
Py_DECREF(chunk);
goto bail; goto bail;
} }
Py_DECREF(chunk); Py_DECREF(chunk);
...@@ -541,8 +542,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict) ...@@ -541,8 +542,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict)
if (rval == NULL) { if (rval == NULL) {
goto bail; goto bail;
} }
Py_DECREF(chunks); Py_CLEAR(chunks);
chunks = NULL;
return Py_BuildValue("(Nn)", rval, end); return Py_BuildValue("(Nn)", rval, end);
bail: bail:
Py_XDECREF(chunks); Py_XDECREF(chunks);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment