about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-11-21 21:19:28 +0000
committerJames Booth <boothj5@gmail.com>2015-11-21 21:19:28 +0000
commitb73ff08a72ceb3f3ffe15fd9222d8fa56c35f01c (patch)
treea1f3f06494abf65281814b06fe32870dd2513f8f
parent4b022687fa4a47ecaca6a2002ff435c769007456 (diff)
downloadprofani-tty-b73ff08a72ceb3f3ffe15fd9222d8fa56c35f01c.tar.gz
Free pref strings
-rw-r--r--src/command/commands.c32
-rw-r--r--src/ui/rosterwin.c8
-rw-r--r--src/xmpp/connection.c1
3 files changed, 31 insertions, 10 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 37c54131..7a97625a 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -3848,7 +3848,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
 {
     if (g_strcmp0(args[0], "lastactivity") == 0) {
         if (args[1] == NULL) {
-            cons_show("Last activity time format: '%s'.", prefs_get_string(PREF_TIME_LASTACTIVITY));
+            char *format = prefs_get_string(PREF_TIME_LASTACTIVITY);
+            cons_show("Last activity time format: '%s'.", format);
+            prefs_free_string(format);
             return TRUE;
         } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
             prefs_set_string(PREF_TIME_LASTACTIVITY, args[2]);
@@ -3865,7 +3867,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
         }
     } else if (g_strcmp0(args[0], "statusbar") == 0) {
         if (args[1] == NULL) {
-            cons_show("Status bar time format: '%s'.", prefs_get_string(PREF_TIME_STATUSBAR));
+            char *format = prefs_get_string(PREF_TIME_STATUSBAR);
+            cons_show("Status bar time format: '%s'.", format);
+            prefs_free_string(format);
             return TRUE;
         } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
             prefs_set_string(PREF_TIME_STATUSBAR, args[2]);
@@ -3883,7 +3887,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
         }
     } else if (g_strcmp0(args[0], "console") == 0) {
         if (args[1] == NULL) {
-            cons_show("Console time format: '%s'.", prefs_get_string(PREF_TIME_CONSOLE));
+            char *format = prefs_get_string(PREF_TIME_CONSOLE);
+            cons_show("Console time format: '%s'.", format);
+            prefs_free_string(format);
             return TRUE;
         } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
             prefs_set_string(PREF_TIME_CONSOLE, args[2]);
@@ -3901,7 +3907,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
         }
     } else if (g_strcmp0(args[0], "chat") == 0) {
         if (args[1] == NULL) {
-            cons_show("Chat time format: '%s'.", prefs_get_string(PREF_TIME_CHAT));
+            char *format = prefs_get_string(PREF_TIME_CHAT);
+            cons_show("Chat time format: '%s'.", format);
+            prefs_free_string(format);
             return TRUE;
         } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
             prefs_set_string(PREF_TIME_CHAT, args[2]);
@@ -3919,7 +3927,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
         }
     } else if (g_strcmp0(args[0], "muc") == 0) {
         if (args[1] == NULL) {
-            cons_show("MUC time format: '%s'.", prefs_get_string(PREF_TIME_MUC));
+            char *format = prefs_get_string(PREF_TIME_MUC);
+            cons_show("MUC time format: '%s'.", format);
+            prefs_free_string(format);
             return TRUE;
         } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
             prefs_set_string(PREF_TIME_MUC, args[2]);
@@ -3937,7 +3947,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
         }
     } else if (g_strcmp0(args[0], "mucconfig") == 0) {
         if (args[1] == NULL) {
-            cons_show("MUC config time format: '%s'.", prefs_get_string(PREF_TIME_MUCCONFIG));
+            char *format = prefs_get_string(PREF_TIME_MUCCONFIG);
+            cons_show("MUC config time format: '%s'.", format);
+            prefs_free_string(format);
             return TRUE;
         } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
             prefs_set_string(PREF_TIME_MUCCONFIG, args[2]);
@@ -3955,7 +3967,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
         }
     } else if (g_strcmp0(args[0], "private") == 0) {
         if (args[1] == NULL) {
-            cons_show("Private chat time format: '%s'.", prefs_get_string(PREF_TIME_PRIVATE));
+            char *format = prefs_get_string(PREF_TIME_PRIVATE);
+            cons_show("Private chat time format: '%s'.", format);
+            prefs_free_string(format);
             return TRUE;
         } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
             prefs_set_string(PREF_TIME_PRIVATE, args[2]);
@@ -3973,7 +3987,9 @@ cmd_time(ProfWin *window, const char *const command, gchar **args)
         }
     } else if (g_strcmp0(args[0], "xml") == 0) {
         if (args[1] == NULL) {
-            cons_show("XML Console time format: '%s'.", prefs_get_string(PREF_TIME_XMLCONSOLE));
+            char *format = prefs_get_string(PREF_TIME_XMLCONSOLE);
+            cons_show("XML Console time format: '%s'.", format);
+            prefs_free_string(format);
             return TRUE;
         } else if (g_strcmp0(args[1], "set") == 0 && args[2] != NULL) {
             prefs_set_string(PREF_TIME_XMLCONSOLE, args[2]);
diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c
index 0dc1baed..c2267437 100644
--- a/src/ui/rosterwin.c
+++ b/src/ui/rosterwin.c
@@ -53,6 +53,7 @@ _rosterwin_presence(ProfLayoutSplit *layout, int indent, theme_item_t colour, co
 
     char *by = prefs_get_string(PREF_ROSTER_BY);
     gboolean by_presence = g_strcmp0(by, "presence") == 0;
+    prefs_free_string(by);
 
     // show only status when grouped by presence
     if (by_presence) {
@@ -207,6 +208,7 @@ _rosterwin_contacts_by_group(ProfLayoutSplit *layout, char *group)
     } else {
         contacts = roster_get_group(group, ROSTER_ORD_NAME, offline);
     }
+    prefs_free_string(order);
 
     if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
         wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
@@ -245,6 +247,7 @@ _rosterwin_contacts_by_no_group(ProfLayoutSplit *layout)
     } else {
         contacts = roster_get_nogroup(ROSTER_ORD_NAME, offline);
     }
+    prefs_free_string(order);
 
     if (contacts || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
         wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));
@@ -280,7 +283,7 @@ rosterwin_roster(void)
         ProfLayoutSplit *layout = (ProfLayoutSplit*)console->layout;
         assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);
 
-       char *by = prefs_get_string(PREF_ROSTER_BY);
+        char *by = prefs_get_string(PREF_ROSTER_BY);
         if (g_strcmp0(by, "presence") == 0) {
             werase(layout->subwin);
             _rosterwin_contacts_by_presence(layout, "chat", "Available for chat");
@@ -311,6 +314,7 @@ rosterwin_roster(void)
             } else {
                 contacts = roster_get_contacts(ROSTER_ORD_NAME, offline);
             }
+            prefs_free_string(order);
 
             werase(layout->subwin);
 
@@ -338,6 +342,6 @@ rosterwin_roster(void)
             }
             g_slist_free(contacts);
         }
-        free(by);
+        prefs_free_string(by);
     }
 }
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index 83907b49..42293c18 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -496,6 +496,7 @@ _jabber_connect(const char *const fulljid, const char *const passwd, const char
     if (cert_path) {
         xmpp_conn_tlscert_path(jabber_conn.conn, cert_path);
     }
+    prefs_free_string(cert_path);
 #endif
 
 #ifdef HAVE_LIBMESODE