plugins/python/python_plugin_common.c: release py_args in close

even if the arguments are not used (eg. when there is no "close" call
in the plugin).

It was not really a memleak, because interpreter is deinitialized anyway,
which frees the object.
This commit is contained in:
Robert Manner
2020-02-13 17:29:01 +01:00
committed by Todd C. Miller
parent b2ae79c2be
commit a71828b385

View File

@@ -510,10 +510,13 @@ python_plugin_close(struct PluginContext *plugin_ctx, const char *callback_name,
sudo_debug_printf(SUDO_DEBUG_INFO, "Python plugin function 'close' is skipped (not present)\n");
} else {
PyObject *py_result = python_plugin_api_call(plugin_ctx, callback_name, py_args);
py_args = NULL; // api call already freed it
Py_XDECREF(py_result);
}
}
Py_CLEAR(py_args);
if (PyErr_Occurred()) {
py_log_last_error(NULL);
}