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:

committed by
Todd C. Miller

parent
b2ae79c2be
commit
a71828b385
@@ -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");
|
sudo_debug_printf(SUDO_DEBUG_INFO, "Python plugin function 'close' is skipped (not present)\n");
|
||||||
} else {
|
} else {
|
||||||
PyObject *py_result = python_plugin_api_call(plugin_ctx, callback_name, py_args);
|
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_XDECREF(py_result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Py_CLEAR(py_args);
|
||||||
|
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
py_log_last_error(NULL);
|
py_log_last_error(NULL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user