Skip to content

Commit

Permalink
[3.13] gh-126991: Fix reference leak in loading pickle's opcode BUILD (
Browse files Browse the repository at this point in the history
…GH-126990) (GH-127018)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
(cherry picked from commit 29cbcbd)

Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
  • Loading branch information
miss-islington and Legoclones authored Nov 19, 2024
1 parent 3fae84f commit bb98a0a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -6659,6 +6659,7 @@ load_build(PickleState *st, UnpicklerObject *self)
}
if (PyObject_SetItem(dict, d_key, d_value) < 0) {
Py_DECREF(d_key);
Py_DECREF(dict);
goto error;
}
Py_DECREF(d_key);
Expand Down

0 comments on commit bb98a0a

Please sign in to comment.