0
0
mirror of https://github.com/python/cpython.git synced 2024-11-23 16:28:04 +01:00

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.
This commit is contained in:
Justin Applegate 2024-11-19 11:00:35 -05:00 committed by GitHub
parent c5c9286804
commit 29cbcbd73b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);