about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-06-15 21:00:01 +0100
committerJames Booth <boothj5@gmail.com>2014-06-15 21:00:01 +0100
commitd6d714e1ed3817ab7540dcb2c794e652b74846c7 (patch)
tree79d5da0ef9771655573508d6cbcee81573fcf9af
parentd181f500ea2548bf6f69a0fb396293c5a4fa6d3b (diff)
downloadprofani-tty-d6d714e1ed3817ab7540dcb2c794e652b74846c7.tar.gz
Free saved account details before replacing
-rw-r--r--src/xmpp/connection.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 5a97a525..a7cdbc1a 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -117,7 +117,13 @@ _jabber_connect_with_account(const ProfAccount * const account)
     log_info("Connecting using account: %s", account->name);
 
     // save account name and password for reconnect
+    if (saved_account.name != NULL) {
+        free(saved_account.name);
+    }
     saved_account.name = strdup(account->name);
+    if (saved_account.passwd != NULL) {
+        free(saved_account.passwd);
+    }
     saved_account.passwd = strdup(account->password);
 
     // connect with fulljid