diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-09-10 21:31:42 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-09-10 21:31:42 (GMT) |
commit | 31a3ec313d442fd9d64a3882669da634d7b70d56 (patch) | |
tree | 15cbc8c30e1575658b49e883b8a3b98137929334 | |
parent | 6d46dff5b5bc7991e62fc00597cb9b32f1cdd170 (diff) | |
download | cpython-31a3ec313d442fd9d64a3882669da634d7b70d56.zip cpython-31a3ec313d442fd9d64a3882669da634d7b70d56.tar.gz cpython-31a3ec313d442fd9d64a3882669da634d7b70d56.tar.bz2 |
Issue #22338: Fix a crash in the json module on memory allocation failure.
-rw-r--r-- | Misc/NEWS | 2 | ||||
-rw-r--r-- | Modules/_json.c | 3 |
2 files changed, 4 insertions, 1 deletions
@@ -32,6 +32,8 @@ Core and Builtins Library ------- +- Issue #22338: Fix a crash in the json module on memory allocation failure. + - Issue #22226: First letter no longer is stripped from the "status" key in the result of Treeview.heading(). diff --git a/Modules/_json.c b/Modules/_json.c index 20f4614..1580ee6 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -287,7 +287,7 @@ _build_rval_index_tuple(PyObject *rval, Py_ssize_t idx) { } \ } \ if (PyList_Append(chunks, chunk)) { \ - Py_DECREF(chunk); \ + Py_CLEAR(chunk); \ goto bail; \ } \ Py_CLEAR(chunk); \ @@ -1555,6 +1555,7 @@ encoder_listencode_dict(PyEncoderObject *s, _PyAccu *acc, if (item == NULL) goto bail; PyList_SET_ITEM(items, i, item); + item = NULL; Py_DECREF(key); } } |