changeset: 92390:3ac9f9576ce6 branch: 3.4 parent: 92387:071a2620917f user: Victor Stinner date: Wed Sep 10 23:31:42 2014 +0200 files: Misc/NEWS Modules/_json.c description: Issue #22338: Fix a crash in the json module on memory allocation failure. diff -r 071a2620917f -r 3ac9f9576ce6 Misc/NEWS --- a/Misc/NEWS Wed Sep 10 17:13:06 2014 -0400 +++ b/Misc/NEWS Wed Sep 10 23:31:42 2014 +0200 @@ -32,6 +32,8 @@ 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 -r 071a2620917f -r 3ac9f9576ce6 Modules/_json.c --- a/Modules/_json.c Wed Sep 10 17:13:06 2014 -0400 +++ b/Modules/_json.c Wed Sep 10 23:31:42 2014 +0200 @@ -287,7 +287,7 @@ } \ } \ if (PyList_Append(chunks, chunk)) { \ - Py_DECREF(chunk); \ + Py_CLEAR(chunk); \ goto bail; \ } \ Py_CLEAR(chunk); \ @@ -1555,6 +1555,7 @@ if (item == NULL) goto bail; PyList_SET_ITEM(items, i, item); + item = NULL; Py_DECREF(key); } }