From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 28 Jun 2024 23:17:34 +0000 (+0200) Subject: [3.13] gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (GH... X-Git-Tag: v3.13.0b4~156 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=50ea6408b8cb31d39a91f3d08b2e7a0e97d9424e;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (GH-121136) (#121139) gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (GH-121136) PyObject_GetAttr returns a new reference, but this reference is never decremented using Py_DECREF, so Py_DECREF calls to this referece are added (cherry picked from commit 92893fd8dc803ed7cdde55d29d25f84ccb5e3ef0) Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com> --- diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 21be88a79d87..4a2191db0cf9 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -6524,11 +6524,13 @@ load_additems(PickleState *state, UnpicklerObject *self) if (result == NULL) { Pdata_clear(self->stack, i + 1); Py_SET_SIZE(self->stack, mark); + Py_DECREF(add_func); return -1; } Py_DECREF(result); } Py_SET_SIZE(self->stack, mark); + Py_DECREF(add_func); } return 0;