diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index fcaf0baa5..477f57b5e 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -52,6 +52,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] [[1.4_bugs]] === Bugs fixed +* core: fix memory leak when using multiple "-d" or "-r" in command line + arguments * core: don't complain any more about "tmux" and "tmux-256color" $TERM values when WeeChat is running under tmux (issue #519) * core: fix truncated messages after a word with a length of zero on screen diff --git a/src/core/weechat.c b/src/core/weechat.c index 5bc295fdd..17a5e3862 100644 --- a/src/core/weechat.c +++ b/src/core/weechat.c @@ -191,7 +191,11 @@ weechat_parse_args (int argc, char *argv[]) || (strcmp (argv[i], "--dir") == 0)) { if (i + 1 < argc) + { + if (weechat_home) + free (weechat_home); weechat_home = strdup (argv[++i]); + } else { string_iconv_fprintf (stderr, @@ -255,7 +259,11 @@ weechat_parse_args (int argc, char *argv[]) || (strcmp (argv[i], "--run-command") == 0)) { if (i + 1 < argc) + { + if (weechat_startup_commands) + free (weechat_startup_commands); weechat_startup_commands = strdup (argv[++i]); + } else { string_iconv_fprintf (stderr,