summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-07-29 18:52:48 (GMT)
committerGitHub <noreply@github.com>2024-07-29 18:52:48 (GMT)
commit68840e91ac6689d3954b98a9ab136e194b5250b8 (patch)
tree138d1ddbec9fbb26eb063d0252708c5a1e615e08
parent490e0ad83ac72c5688dfbbab4eac61ccfd7be5fd (diff)
downloadcpython-68840e91ac6689d3954b98a9ab136e194b5250b8.zip
cpython-68840e91ac6689d3954b98a9ab136e194b5250b8.tar.gz
cpython-68840e91ac6689d3954b98a9ab136e194b5250b8.tar.bz2
gh-122311: Fix a refleak in pickle (GH-122411)
-rw-r--r--Modules/_pickle.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 452b4af..50c73dc 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);