Skip to content

Commit

Permalink
gh-121137: Add missing Py_DECREF calls for ADDITEMS opcode of _pickle…
Browse files Browse the repository at this point in the history
….c (#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
  • Loading branch information
Legoclones authored Jun 28, 2024
1 parent e6543da commit 92893fd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 92893fd

Please sign in to comment.