summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-10-30 12:20:01 +0100
committerSébastien Helleu <flashcode@flashtux.org>2023-10-30 23:10:54 +0100
commit3c62ae482b297b68d494dac02c9a71055581e06e (patch)
tree433b236fa54ae74b3d42daaddbd8ebde6a9df830
parentfd78c2f9ac0e2cea2a2b098d93439e2707984c84 (diff)
downloadweechat-3c62ae482b297b68d494dac02c9a71055581e06e.zip
core: fix memory leak when infolist variable can not be created
-rw-r--r--src/core/hook/wee-hook-command.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/hook/wee-hook-command.c b/src/core/hook/wee-hook-command.c
index 3e985fa01..f130ea3bc 100644
--- a/src/core/hook/wee-hook-command.c
+++ b/src/core/hook/wee-hook-command.c
@@ -1082,7 +1082,11 @@ hook_command_add_to_infolist (struct t_infolist_item *item,
HOOK_COMMAND(hook, args_description));
if (!infolist_new_var_string (item, "args_description_nls",
(args_desc_nls) ? args_desc_nls : ""))
+ {
+ if (args_desc_nls)
+ free (args_desc_nls);
return 0;
+ }
if (args_desc_nls)
free (args_desc_nls);
if (!infolist_new_var_string (item, "completion", HOOK_COMMAND(hook, completion)))