]> jfr.im git - irc/weechat/weechat.git/commitdiff
core: fix memory leak when infolist variable can not be created
authorSébastien Helleu <redacted>
Mon, 30 Oct 2023 11:20:01 +0000 (12:20 +0100)
committerSébastien Helleu <redacted>
Mon, 30 Oct 2023 22:10:54 +0000 (23:10 +0100)
src/core/hook/wee-hook-command.c

index 3e985fa018106c7d8948f8bd0c24aa5a40cca168..f130ea3bc4bccd00f3f652e19d657d2d13bc494d 100644 (file)
@@ -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)))