From 020c8145b610c4f5472129344728f8e4d4a7989e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 7 Oct 2023 20:33:42 +0200 Subject: [PATCH] irc: fix memory leak when joining channels with keys --- ChangeLog.adoc | 1 + src/plugins/irc/irc-command.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 25048a4ef..fce1280f6 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -16,6 +16,7 @@ For a list of important changes that require manual actions, please look at rele Bug fixes:: * core: fix generation of TOTP on Big Endian systems (issue #2021) + * irc: fix memory leak when joining channels with keys Build:: diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 5d3421167..04c6155fa 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -2907,11 +2907,13 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments, pos_keys++; } if (pos_keys[0]) + { keys = weechat_string_split (pos_keys, ",", NULL, WEECHAT_STRING_SPLIT_STRIP_LEFT | WEECHAT_STRING_SPLIT_STRIP_RIGHT | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS, 0, &num_keys); + } } else new_args = strdup (arguments); @@ -3025,6 +3027,9 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments, } weechat_string_free_split (channels); } + + if (keys) + weechat_string_free_split (keys); } /*