From 3c62ae482b297b68d494dac02c9a71055581e06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 30 Oct 2023 12:20:01 +0100 Subject: [PATCH] core: fix memory leak when infolist variable can not be created --- src/core/hook/wee-hook-command.c | 4 ++++ 1 file changed, 4 insertions(+) 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)))