1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Free aliases on cmd_init

This commit is contained in:
James Booth 2014-06-18 21:36:09 +01:00
parent 7344d3b898
commit d668d15081
2 changed files with 9 additions and 4 deletions

View File

@ -971,6 +971,7 @@ cmd_init(void)
g_string_free(ac_alias, TRUE);
curr = g_list_next(curr);
}
prefs_free_aliases(aliases);
prefs_ac = autocomplete_new();
autocomplete_add(prefs_ac, "ui");

View File

@ -348,11 +348,15 @@ prefs_get_aliases(void)
char *name = keys[i];
char *value = g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL);
ProfAlias *alias = malloc(sizeof(struct prof_alias_t));
alias->name = strdup(name);
alias->value = strdup(value);
if (value != NULL) {
ProfAlias *alias = malloc(sizeof(struct prof_alias_t));
alias->name = strdup(name);
alias->value = strdup(value);
result = g_list_insert_sorted(result, alias, (GCompareFunc)_alias_cmp);
free(value);
result = g_list_insert_sorted(result, alias, (GCompareFunc)_alias_cmp);
}
}
g_strfreev(keys);