From d6d714e1ed3817ab7540dcb2c794e652b74846c7 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 15 Jun 2014 21:00:01 +0100 Subject: [PATCH] Free saved account details before replacing --- src/xmpp/connection.c | 6 ++++++ 1 file changed, 6 insertions(+) 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