From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 29 Jul 2024 19:16:15 +0000 (+0200) Subject: [3.13] gh-122311: Fix a refleak in pickle (GH-122411) (GH-122415) X-Git-Tag: v3.13.0rc1~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d8701e2f7e4f353438a45fdb039ef079a97a7a2a;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-122311: Fix a refleak in pickle (GH-122411) (GH-122415) (cherry picked from commit 68840e91ac6689d3954b98a9ab136e194b5250b8) Co-authored-by: Serhiy Storchaka --- diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 3a2e8bc4aa69..9f92d0e99a1e 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -3123,6 +3123,7 @@ batch_dict(PickleState *state, PicklerObject *self, PyObject *iter) if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 2) { PyErr_SetString(PyExc_TypeError, "dict items " "iterator must return 2-tuples"); + Py_DECREF(obj); return -1; } i = save(state, self, PyTuple_GET_ITEM(obj, 0), 0);