summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-12-23 07:17:37 +0100
committerSébastien Helleu <flashcode@flashtux.org>2015-12-23 07:17:37 +0100
commit841444b68cb38b4d928edd3d0ea19f94d2d20b9f (patch)
tree509cab66a4d6db2aba75a211e539541c165c57fc /src/core
parentcb23d0166a8f65221d1033a2d2490d5448cc30d9 (diff)
downloadweechat-841444b68cb38b4d928edd3d0ea19f94d2d20b9f.zip
core: fix memory leak when using multiple "-d" or "-r" in command line arguments
Diffstat (limited to 'src/core')
-rw-r--r--src/core/weechat.c8
1 files changed, 8 insertions, 0 deletions
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,