mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.12] gh-102251: Fix reference leak in _testsinglephase initialization (GH-105082) (#105083)
Correctly decref 'initialized' in init_module()
(cherry picked from commit d14eb3433c
)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
parent
7f04a1546f
commit
fd6b913535
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue