mirror of
https://github.com/weechat/weechat.git
synced 2026-06-24 03:46:39 +02:00
scripts: fix memory leak in hook_info callback
This commit is contained in:
@@ -59,6 +59,8 @@
|
||||
plugin_script_str2ptr (weechat_python_plugin, \
|
||||
PYTHON_CURRENT_SCRIPT_NAME, \
|
||||
python_function_name, __string)
|
||||
#define API_STATIC_STRING(__string) \
|
||||
plugin_script_get_static_string(&python_data, __string);
|
||||
#define API_RETURN_OK return PyLong_FromLong((long)1)
|
||||
#define API_RETURN_ERROR return PyLong_FromLong ((long)0)
|
||||
#define API_RETURN_EMPTY \
|
||||
@@ -2948,7 +2950,7 @@ weechat_python_api_hook_info_cb (const void *pointer, void *data,
|
||||
{
|
||||
struct t_plugin_script *script;
|
||||
void *func_argv[3];
|
||||
char empty_arg[1] = { '\0' };
|
||||
char empty_arg[1] = { '\0' }, *result;
|
||||
const char *ptr_function, *ptr_data;
|
||||
|
||||
script = (struct t_plugin_script *)pointer;
|
||||
@@ -2960,10 +2962,12 @@ weechat_python_api_hook_info_cb (const void *pointer, void *data,
|
||||
func_argv[1] = (info_name) ? (char *)info_name : empty_arg;
|
||||
func_argv[2] = (arguments) ? (char *)arguments : empty_arg;
|
||||
|
||||
return (const char *)weechat_python_exec (script,
|
||||
WEECHAT_SCRIPT_EXEC_STRING,
|
||||
ptr_function,
|
||||
"sss", func_argv);
|
||||
result = (char *)weechat_python_exec (script,
|
||||
WEECHAT_SCRIPT_EXEC_STRING,
|
||||
ptr_function,
|
||||
"sss", func_argv);
|
||||
|
||||
return API_STATIC_STRING(result);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user