Skip to content

Commit 29cbcbd

Browse files
authored
gh-126991: Fix reference leak in loading pickle's opcode BUILD (GH-126990)
If PyObject_SetItem() fails in the `load_build()` function of _pickle.c, no DECREF for the `dict` variable.
1 parent c5c9286 commit 29cbcbd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Modules/_pickle.c

+1
Original file line numberDiff line numberDiff line change
@@ -6730,6 +6730,7 @@ load_build(PickleState *st, UnpicklerObject *self)
67306730
}
67316731
if (PyObject_SetItem(dict, d_key, d_value) < 0) {
67326732
Py_DECREF(d_key);
6733+
Py_DECREF(dict);
67336734
goto error;
67346735
}
67356736
Py_DECREF(d_key);

0 commit comments

Comments
 (0)