Kaydet (Commit) 8e8c2152 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

Merged revisions 66938,66942 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r66938 | benjamin.peterson | 2008-10-16 16:27:54 -0500 (Thu, 16 Oct 2008) | 1 line

  fix possible ref leak
........
  r66942 | benjamin.peterson | 2008-10-16 16:48:06 -0500 (Thu, 16 Oct 2008) | 1 line

  fix more possible ref leaks in _json and use Py_CLEAR
........
üst a13d4759
...@@ -276,6 +276,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) ...@@ -276,6 +276,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, 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);
...@@ -377,6 +378,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) ...@@ -377,6 +378,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, 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);
...@@ -386,8 +388,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) ...@@ -386,8 +388,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, 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);
...@@ -436,6 +437,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict) ...@@ -436,6 +437,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);
...@@ -537,6 +539,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict) ...@@ -537,6 +539,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);
...@@ -546,8 +549,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict) ...@@ -546,8 +549,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