mirror of
https://github.com/weechat/weechat.git
synced 2026-06-25 04:16:38 +02:00
scripts: fix memory leak in hook_info callback
This commit is contained in:
@@ -95,7 +95,8 @@ extern "C"
|
||||
plugin_script_str2ptr (weechat_js_plugin, \
|
||||
JS_CURRENT_SCRIPT_NAME, \
|
||||
js_function_name.c_str(), __string)
|
||||
|
||||
#define API_STATIC_STRING(__string) \
|
||||
plugin_script_get_static_string(&js_data, __string);
|
||||
#define API_RETURN_OK return v8::True();
|
||||
#define API_RETURN_ERROR return v8::False();
|
||||
#define API_RETURN_EMPTY \
|
||||
@@ -2779,7 +2780,7 @@ weechat_js_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;
|
||||
@@ -2791,10 +2792,12 @@ weechat_js_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_js_exec (script,
|
||||
WEECHAT_SCRIPT_EXEC_STRING,
|
||||
ptr_function,
|
||||
"sss", func_argv);
|
||||
result = (char *)weechat_js_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