Skip to content

Commit 5c06b34

Browse files
[3.12] gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle.c (GH-121136) (#121140)
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 92893fd) Co-authored-by: Justin Applegate <[email protected]>
1 parent 3a420de commit 5c06b34

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/_pickle.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6623,11 +6623,13 @@ load_additems(PickleState *state, UnpicklerObject *self)
66236623
if (result == NULL) {
66246624
Pdata_clear(self->stack, i + 1);
66256625
Py_SET_SIZE(self->stack, mark);
6626+
Py_DECREF(add_func);
66266627
return -1;
66276628
}
66286629
Py_DECREF(result);
66296630
}
66306631
Py_SET_SIZE(self->stack, mark);
6632+
Py_DECREF(add_func);
66316633
}
66326634

66336635
return 0;

0 commit comments

Comments
 (0)