about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-09-23 01:34:35 +0100
committerJames Booth <boothj5@gmail.com>2013-09-23 01:34:35 +0100
commit70452c119453f491be537aec214ae76449d8ace8 (patch)
tree5e213793bb1e034a86f521b161e869a6ee99e423 /src/command
parentb738e8f363e3470eb97ac941d945194e19f3c198 (diff)
downloadprofani-tty-70452c119453f491be537aec214ae76449d8ace8.tar.gz
Fixed memory leak in _cmd_join
issue #226
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 9ece5964..e8232405 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -2725,6 +2725,7 @@ static gboolean
 _cmd_join(gchar **args, struct cmd_help_t help)
 {
     jabber_conn_status_t conn_status = jabber_get_connection_status();
+    ProfAccount *account = accounts_get_account(jabber_get_account_name());
 
     if (conn_status != JABBER_CONNECTED) {
         cons_show("You are not currently connected.");
@@ -2749,7 +2750,6 @@ _cmd_join(gchar **args, struct cmd_help_t help)
 
     // server not supplied (room), use account preference
     } else {
-        ProfAccount *account = accounts_get_account(jabber_get_account_name());
         g_string_append(room_str, args[0]);
         g_string_append(room_str, "@");
         g_string_append(room_str, account->muc_service);
@@ -2762,7 +2762,6 @@ _cmd_join(gchar **args, struct cmd_help_t help)
 
     // otherwise use account preference
     } else {
-        ProfAccount *account = accounts_get_account(jabber_get_account_name());
         nick = account->muc_nick;
     }
 
@@ -2778,6 +2777,7 @@ _cmd_join(gchar **args, struct cmd_help_t help)
     jid_destroy(room_jid);
     jid_destroy(my_jid);
     g_string_free(room_str, TRUE);
+    accounts_free_account(account);
 
     return TRUE;
 }