]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-122311: Fix a refleak in pickle (GH-122411) (GH-122415)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 29 Jul 2024 19:16:15 +0000 (21:16 +0200)
committerGitHub <noreply@github.com>
Mon, 29 Jul 2024 19:16:15 +0000 (19:16 +0000)
(cherry picked from commit 68840e91ac6689d3954b98a9ab136e194b5250b8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Modules/_pickle.c

index 3a2e8bc4aa69e3d0e43da0046bb18c0a0afb6ad6..9f92d0e99a1e58b89c28665c139f15cbdacd4183 100644 (file)
@@ -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);