From bad84975ffdad07a3a4fe923280e65c1609bf1f2 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Mon, 29 Jul 2024 21:10:46 +0200 Subject: [PATCH] [3.12] gh-122311: Fix a refleak in pickle (GH-122411) (GH-122416) (cherry picked from commit 68840e91ac6689d3954b98a9ab136e194b5250b8) Co-authored-by: Serhiy Storchaka --- Modules/_pickle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 498680995720..96534a565b3a 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -3188,6 +3188,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); -- 2.47.3