Merge sudo_module_register_loghandler and sudo_module_set_default_loghandler.

We now create the LogHandler class for each interpreter in
python_plugin_init() instead of just once in sudo_module_init().
This fixes the crash seen in Py_EndInterpreter() with Python 3.12
and significantly reduces the number of leaked objects tracked by
MemorySanitizer.
This commit is contained in:
Todd C. Miller
2023-07-24 11:07:45 -06:00
parent 56b829f66b
commit 09b9632699
4 changed files with 28 additions and 51 deletions

View File

@@ -595,9 +595,6 @@ sudo_module_init(void)
if (sudo_module_register_baseplugin(py_module) != SUDO_RC_OK)
goto cleanup;
if (sudo_module_register_loghandler(py_module) != SUDO_RC_OK)
goto cleanup;
cleanup:
if (PyErr_Occurred()) {
Py_CLEAR(py_module);