gh-86493: Fix possible leaks in modules initialization: _curses_panel, _decimal, posix, xxsubtype (GH-106767)

This commit is contained in:
Serhiy Storchaka 2023-07-18 09:00:22 +03:00 • committed by GitHub
parent e1c295e3da
commit 745492355b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 55 deletions

View file

@ -662,8 +662,7 @@ _curses_panel_exec(PyObject *mod)
state->PyCursesError = PyErr_NewException(
"_curses_panel.error", NULL, NULL);
if (PyModule_AddObject(mod, "error", Py_NewRef(state->PyCursesError)) < 0) {
Py_DECREF(state->PyCursesError);
if (PyModule_AddObjectRef(mod, "error", state->PyCursesError) < 0) {
return -1;
}