mirror of
https://github.com/python/cpython.git
synced 2025-09-09 02:11:51 +00:00
gh-102251: Fix reference leak in _testsinglephase initialization (#105082)
Correctly decref 'initialized' in init_module() Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
parent
219f01b185
commit
d14eb3433c
1 changed files with 3 additions and 1 deletions
|
@ -140,7 +140,9 @@ init_module(PyObject *module, module_state *state)
|
||||||
if (initialized == NULL) {
|
if (initialized == NULL) {
|
||||||
return -1;
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue