about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-02-09 21:21:22 +0000
committerJames Booth <boothj5@gmail.com>2015-02-09 21:21:22 +0000
commit6682f243ce2cbb46a1323bcd5fdf3a672b5a5d00 (patch)
tree477438ecfc75e927d245163ce7c4e137819a271d /src
parentaad7b3ed8ac245252e8d400ee79205a196989a11 (diff)
downloadprofani-tty-6682f243ce2cbb46a1323bcd5fdf3a672b5a5d00.tar.gz
Free theme list after use
Diffstat (limited to 'src')
-rw-r--r--src/command/command.c11
-rw-r--r--src/config/theme.c4
2 files changed, 9 insertions, 6 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 9f17596b..f05d2a79 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1659,7 +1659,7 @@ cmd_reset_autocomplete()
     autocomplete_reset(autoconnect_ac);
     autocomplete_reset(theme_ac);
     if (theme_load_ac != NULL) {
-        autocomplete_reset(theme_load_ac);
+        autocomplete_free(theme_load_ac);
         theme_load_ac = NULL;
     }
     autocomplete_reset(account_ac);
@@ -2473,11 +2473,12 @@ _theme_autocomplete(const char * const input)
         if (theme_load_ac == NULL) {
             theme_load_ac = autocomplete_new();
             GSList *themes = theme_list();
-            while (themes != NULL) {
-                autocomplete_add(theme_load_ac, themes->data);
-                themes = g_slist_next(themes);
+            GSList *curr = themes;
+            while (curr != NULL) {
+                autocomplete_add(theme_load_ac, curr->data);
+                curr = g_slist_next(curr);
             }
-            g_slist_free(themes);
+            g_slist_free_full(themes, g_free);
             autocomplete_add(theme_load_ac, "default");
         }
         result = autocomplete_param_with_ac(input, "/theme set", theme_load_ac, TRUE);
diff --git a/src/config/theme.c b/src/config/theme.c
index a5dbd0dd..26d48091 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -192,7 +192,9 @@ GSList *
 theme_list(void)
 {
     GSList *result = NULL;
-    _theme_list_dir(_get_themes_dir(), &result);
+    char *themes_dir = _get_themes_dir();
+    _theme_list_dir(themes_dir, &result);
+    free(themes_dir);
 #ifdef THEMES_PATH
     _theme_list_dir(THEMES_PATH, &result);
 #endif