[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 92893fd8dc)

Co-authored-by: Justin Applegate <70449145+Legoclones@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-06-29 01:17:34 +02:00 committed by GitHub
parent 58a3c3c0ad
commit 50ea6408b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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