summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-command.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-03-19 10:17:32 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-03-19 10:17:32 +0100
commit872ff1cc6d542f9eb74083116f96582e409b7e7c (patch)
tree3b2ecdcc5aba916c2ca2e532167bb9d2c3caf7f9 /src/plugins/irc/irc-command.c
parent8123cb3e0b1d390531cec20c7808f473b0d4a6d3 (diff)
downloadweechat-872ff1cc6d542f9eb74083116f96582e409b7e7c.zip
irc: fix memory leak in command /autojoin addraw when channels are missing
Diffstat (limited to 'src/plugins/irc/irc-command.c')
-rw-r--r--src/plugins/irc/irc-command.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 9f1aa1d34..d0dca1d1f 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -958,7 +958,12 @@ IRC_COMMAND_CALLBACK(autojoin)
/* add raw channel(s) */
if (weechat_strcasecmp (argv[1], "addraw") == 0)
{
- WEECHAT_COMMAND_MIN_ARGS(3, "addraw");
+ if (argc < 3)
+ {
+ if (old_autojoin)
+ free (old_autojoin);
+ WEECHAT_COMMAND_MIN_ARGS(3, "addraw");
+ }
irc_join_add_channels_to_autojoin (ptr_server, argv_eol[2]);
goto end;
}