summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_json.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index 0068bda..9c35f64 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -276,6 +276,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict)
goto bail;
}
if (PyList_Append(chunks, chunk)) {
+ Py_DECREF(chunk);
goto bail;
}
Py_DECREF(chunk);
@@ -377,6 +378,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict)
goto bail;
}
if (PyList_Append(chunks, chunk)) {
+ Py_DECREF(chunk);
goto bail;
}
Py_DECREF(chunk);
@@ -386,8 +388,7 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, 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);
@@ -436,6 +437,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);
@@ -537,6 +539,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);
@@ -546,8 +549,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);