diff options
author | James Booth <boothj5@gmail.com> | 2014-06-15 21:33:29 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-06-15 21:33:29 +0100 |
commit | 2c4e2d5dbd48dd06a2aa0ebd6fae59c0c2a2c337 (patch) | |
tree | a9448e678b225c94dbb5c0b2d13da26cb68e4eaa | |
parent | 258a0ec8734de09f2ef3fcd612d14b8af9811914 (diff) | |
download | profani-tty-2c4e2d5dbd48dd06a2aa0ebd6fae59c0c2a2c337.tar.gz |
Fixed memleak in otr.c
-rw-r--r-- | src/otr/otr.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/otr/otr.c b/src/otr/otr.c index e13e2d3e..501c7583 100644 --- a/src/otr/otr.c +++ b/src/otr/otr.c @@ -104,10 +104,12 @@ static void cb_write_fingerprints(void *opdata) { gcry_error_t err = 0; - gchar *data_home = xdg_get_data_home(); - gchar *account_dir = str_replace(jid, "@", "_at_"); + gchar *data_home = xdg_get_data_home(); GString *basedir = g_string_new(data_home); + free(data_home); + + gchar *account_dir = str_replace(jid, "@", "_at_"); g_string_append(basedir, "/profanity/otr/"); g_string_append(basedir, account_dir); g_string_append(basedir, "/"); @@ -174,9 +176,10 @@ _otr_on_connect(ProfAccount *account) log_info("Loading OTR key for %s", jid); gchar *data_home = xdg_get_data_home(); - gchar *account_dir = str_replace(jid, "@", "_at_"); - GString *basedir = g_string_new(data_home); + free(data_home); + + gchar *account_dir = str_replace(jid, "@", "_at_"); g_string_append(basedir, "/profanity/otr/"); g_string_append(basedir, account_dir); g_string_append(basedir, "/"); @@ -256,9 +259,10 @@ _otr_keygen(ProfAccount *account) jid = strdup(account->jid); gchar *data_home = xdg_get_data_home(); - gchar *account_dir = str_replace(jid, "@", "_at_"); - GString *basedir = g_string_new(data_home); + free(data_home); + + gchar *account_dir = str_replace(jid, "@", "_at_"); g_string_append(basedir, "/profanity/otr/"); g_string_append(basedir, account_dir); g_string_append(basedir, "/"); |