Skip to content

Commit

Permalink
pythongh-102251: Fix reference leak in _testsinglephase initialization (
Browse files Browse the repository at this point in the history
pythonGH-105082)

Correctly decref 'initialized' in init_module()

(cherry picked from commit d14eb34)

Co-authored-by: sunmy2019 <[email protected]>
Co-authored-by: Erlend E. Aasland <[email protected]>
  • Loading branch information
2 people authored and miss-islington committed May 30, 2023
1 parent 7f04a15 commit 7924bd6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Modules/_testsinglephase.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ init_module(PyObject *module, module_state *state)
if (initialized == NULL) {
return -1;
}
if (PyModule_AddObjectRef(module, "_module_initialized", initialized) != 0) {
int rc = PyModule_AddObjectRef(module, "_module_initialized", initialized);
Py_DECREF(initialized);
if (rc < 0) {
return -1;
}

Expand Down

0 comments on commit 7924bd6

Please sign in to comment.