about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-06-15 21:33:29 +0100
committerJames Booth <boothj5@gmail.com>2014-06-15 21:33:29 +0100
commit2c4e2d5dbd48dd06a2aa0ebd6fae59c0c2a2c337 (patch)
treea9448e678b225c94dbb5c0b2d13da26cb68e4eaa
parent258a0ec8734de09f2ef3fcd612d14b8af9811914 (diff)
downloadprofani-tty-2c4e2d5dbd48dd06a2aa0ebd6fae59c0c2a2c337.tar.gz
Fixed memleak in otr.c
-rw-r--r--src/otr/otr.c16
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, "/");