about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-04-08 11:44:16 +0200
committerGitHub <noreply@github.com>2019-04-08 11:44:16 +0200
commit6b064cfde4456c25bd9dbcbfe0a79262ebcb3599 (patch)
treecd9071cb092e912d9551a0440adfa2e18bf541d6 /src/command
parentf7cb40ecf0b53a706875f1223dc99cf6481c3618 (diff)
parentaa9dcf7b3a7434f1807c625c2afe834524ba7c8e (diff)
downloadprofani-tty-6b064cfde4456c25bd9dbcbfe0a79262ebcb3599.tar.gz
Merge pull request #1047 from paulfariello/hotfix/1046
Avoid use after free on default account 
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_funcs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index d280e6c8..b2f0ee7f 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -387,6 +387,7 @@ cmd_connect(ProfWin *window, const char *const command, gchar **args)
     }
 
     char *jid;
+    user = strdup(user);
     g_free(def);
 
     // connect with account
@@ -413,7 +414,6 @@ cmd_connect(ProfWin *window, const char *const command, gchar **args)
                 account->password = NULL;
             } else {
                 cons_show("Error evaluating password, see logs for details.");
-                g_free(user);
                 account_free(account);
                 return TRUE;
             }
@@ -444,6 +444,7 @@ cmd_connect(ProfWin *window, const char *const command, gchar **args)
 
     options_destroy(options);
     free(jid);
+    free(user);
 
     return TRUE;
 }