Visitar URL original
[3.12] gh-102251: Fix reference leak in _testsinglephase initialization (GH-105082) by miss-islington · Pull Request #105083 · python/cpython · GitHub
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-102251: Fix reference leak in _testsinglephase initialization (GH-…
…105082)

Correctly decref 'initialized' in init_module()

(cherry picked from commit d14eb34)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
  • Loading branch information
2 people authored and miss-islington committed May 30, 2023
commit 7924bd62f1ce2116dc573f8be51ebf84c8c57a6a
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