about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-06-24 14:27:40 +0100
committerJames Booth <boothj5@gmail.com>2015-06-24 14:27:40 +0100
commit17919298f78531dbec1eb1b22db1dfc8ad76d854 (patch)
tree93bdb9d28542a0944e0662c3003602b041784d3e
parent815ca16f48b38fea0f8e06fb0164e4ba1894a932 (diff)
downloadprofani-tty-17919298f78531dbec1eb1b22db1dfc8ad76d854.tar.gz
Free prefs strings, check for NULLs when closing pgp module
-rw-r--r--src/pgp/gpg.c18
-rw-r--r--src/ui/console.c1
-rw-r--r--src/ui/inputwin.c1
-rw-r--r--src/ui/statusbar.c3
4 files changed, 17 insertions, 6 deletions
diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c
index e02a3595..32259f61 100644
--- a/src/pgp/gpg.c
+++ b/src/pgp/gpg.c
@@ -74,14 +74,20 @@ p_gpg_init(void)
 void
 p_gpg_close(void)
 {
-    g_hash_table_destroy(fingerprints);
-    fingerprints = NULL;
+    if (fingerprints) {
+        g_hash_table_destroy(fingerprints);
+        fingerprints = NULL;
+    }
 
-    g_key_file_free(fpskeyfile);
-    fpskeyfile = NULL;
+    if (fpskeyfile) {
+        g_key_file_free(fpskeyfile);
+        fpskeyfile = NULL;
+    }
 
-    free(fpsloc);
-    fpsloc = NULL;
+    if (fpsloc) {
+        free(fpsloc);
+        fpsloc = NULL;
+    }
 }
 
 void
diff --git a/src/ui/console.c b/src/ui/console.c
index 6c396376..226619e9 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -1043,6 +1043,7 @@ cons_roster_setting(void)
 
     char *by = prefs_get_string(PREF_ROSTER_BY);
     cons_show("Roster by (/roster)           : %s", by);
+    prefs_free_string(by);
 
     int size = prefs_get_roster_size();
     cons_show("Roster size (/roster)         : %d", size);
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index e29cec6c..303305b5 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -449,6 +449,7 @@ _inp_rl_tab_handler(int count, int key)
         if (result) {
             rl_replace_line(result, 0);
             rl_point = rl_end;
+            free(result);
         }
     }
 
diff --git a/src/ui/statusbar.c b/src/ui/statusbar.c
index 581e63df..97321bca 100644
--- a/src/ui/statusbar.c
+++ b/src/ui/statusbar.c
@@ -136,6 +136,7 @@ status_bar_resize(void)
         } else {
             mvwprintw(status_bar, 0, 1, message);
         }
+        prefs_free_string(time_pref);
     }
     if (last_time) {
         g_date_time_unref(last_time);
@@ -310,6 +311,7 @@ status_bar_print_message(const char * const msg)
     } else {
         mvwprintw(status_bar, 0, 1, message);
     }
+    prefs_free_string(time_pref);
 
     int cols = getmaxx(stdscr);
     int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
@@ -459,6 +461,7 @@ _status_bar_draw(void)
         wattroff(status_bar, bracket_attrs);
         g_free(date_fmt);
     }
+    prefs_free_string(time_pref);
 
     _update_win_statuses();
     wnoutrefresh(status_bar);