1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Free theme list after use

This commit is contained in:
James Booth 2015-02-09 21:21:22 +00:00
parent aad7b3ed8a
commit 6682f243ce
2 changed files with 9 additions and 6 deletions

View File

@ -1659,7 +1659,7 @@ cmd_reset_autocomplete()
autocomplete_reset(autoconnect_ac); autocomplete_reset(autoconnect_ac);
autocomplete_reset(theme_ac); autocomplete_reset(theme_ac);
if (theme_load_ac != NULL) { if (theme_load_ac != NULL) {
autocomplete_reset(theme_load_ac); autocomplete_free(theme_load_ac);
theme_load_ac = NULL; theme_load_ac = NULL;
} }
autocomplete_reset(account_ac); autocomplete_reset(account_ac);
@ -2473,11 +2473,12 @@ _theme_autocomplete(const char * const input)
if (theme_load_ac == NULL) { if (theme_load_ac == NULL) {
theme_load_ac = autocomplete_new(); theme_load_ac = autocomplete_new();
GSList *themes = theme_list(); GSList *themes = theme_list();
while (themes != NULL) { GSList *curr = themes;
autocomplete_add(theme_load_ac, themes->data); while (curr != NULL) {
themes = g_slist_next(themes); 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"); autocomplete_add(theme_load_ac, "default");
} }
result = autocomplete_param_with_ac(input, "/theme set", theme_load_ac, TRUE); result = autocomplete_param_with_ac(input, "/theme set", theme_load_ac, TRUE);

View File

@ -192,7 +192,9 @@ GSList *
theme_list(void) theme_list(void)
{ {
GSList *result = NULL; 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 #ifdef THEMES_PATH
_theme_list_dir(THEMES_PATH, &result); _theme_list_dir(THEMES_PATH, &result);
#endif #endif