Skip to content

Commit bb98a0a

Browse files
[3.13] pythongh-126991: Fix reference leak in loading pickle's opcode BUILD (pythonGH-126990) (pythonGH-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 <[email protected]>
1 parent 3fae84f commit bb98a0a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Modules/_pickle.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6659,6 +6659,7 @@ load_build(PickleState *st, UnpicklerObject *self)
66596659
}
66606660
if (PyObject_SetItem(dict, d_key, d_value) < 0) {
66616661
Py_DECREF(d_key);
6662+
Py_DECREF(dict);
66626663
goto error;
66636664
}
66646665
Py_DECREF(d_key);

0 commit comments

Comments
 (0)