Skip to content

Commit

Permalink
pythongh-126991: Fix reference leak in loading pickle's opcode BUILD (p…
Browse files Browse the repository at this point in the history
…ythonGH-126990)

If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
  • Loading branch information
Legoclones authored Nov 19, 2024
1 parent c5c9286 commit 29cbcbd
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 @@ -6730,6 +6730,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 29cbcbd

Please sign in to comment.