From 2c4e2d5dbd48dd06a2aa0ebd6fae59c0c2a2c337 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 15 Jun 2014 21:33:29 +0100 Subject: Fixed memleak in otr.c --- src/otr/otr.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') 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, "/"); -- cgit 1.4.1-2-gfad0