changeset: 99330:a94fe5432006 branch: 3.4 parent: 99316:4799615f4f26 user: Victor Stinner date: Tue Nov 24 23:28:13 2015 +0100 files: Misc/NEWS Modules/_pickle.c description: Issue #25725: Fix a reference leak in pickle.loads() when unpickling invalid data including tuple instructions. diff -r 4799615f4f26 -r a94fe5432006 Misc/NEWS --- a/Misc/NEWS Mon Nov 23 23:50:26 2015 +0000 +++ b/Misc/NEWS Tue Nov 24 23:28:13 2015 +0100 @@ -106,6 +106,9 @@ Core and Builtins Library ------- +- Issue #25725: Fix a reference leak in pickle.loads() when unpickling invalid + data including tuple instructions. + - Issue #25663: In the Readline completer, avoid listing duplicate global names, and search the global namespace before searching builtins. diff -r 4799615f4f26 -r a94fe5432006 Modules/_pickle.c --- a/Modules/_pickle.c Mon Nov 23 23:50:26 2015 +0000 +++ b/Modules/_pickle.c Tue Nov 24 23:28:13 2015 +0100 @@ -4943,8 +4943,10 @@ load_counted_tuple(UnpicklerObject *self PyObject *item; PDATA_POP(self->stack, item); - if (item == NULL) + if (item == NULL) { + Py_DECREF(tuple); return -1; + } PyTuple_SET_ITEM(tuple, len, item); } PDATA_PUSH(self->stack, tuple, -1);