From bea9d5a2bf405a595cada9634261a33426a8c328 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 7d05e1ad2..9103b819a 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -58,6 +58,7 @@ Bug fixes:: * fset: remove extra spaces between min and max values when second format is used * fset: fix mouse actions when second format is used * fset: apply option fset.color.help_description (issue #1988) + * irc: fix memory leak when joining channels with keys * irc: fix unexpected message sent to server when part of the second line of an IRC command (issue #1992) * irc: fix display of country code in message 344 received as whois geo info (issue #1736) * irc: add missing "account-tag" in list of supported capabilities diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 31a7eb4bb..5495a83c5 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -2888,11 +2888,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); @@ -3000,6 +3002,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); } /*