https://github.com/python/cpython/commit/29cbcbd73bbfd8c953c0b213fb33682c289934ff
commit: 29cbcbd73bbfd8c953c0b213fb33682c289934ff
branch: main
author: Justin Applegate <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-11-19T18:00:35+02:00
summary:

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.

files:
M Modules/_pickle.c

diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 5837cd41a40cd4..2696f38046121f 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -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);

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to