Skip to content

Commit 153221a

Browse files
[3.12] gh-126991: Fix reference leak in loading pickle's opcode BUILD (GH-126990) (GH-127019)
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 cb98122 commit 153221a

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
@@ -6726,6 +6726,7 @@ load_build(PickleState *st, UnpicklerObject *self)
67266726
}
67276727
if (PyObject_SetItem(dict, d_key, d_value) < 0) {
67286728
Py_DECREF(d_key);
6729+
Py_DECREF(dict);
67296730
goto error;
67306731
}
67316732
Py_DECREF(d_key);

0 commit comments

Comments
 (0)