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

Check for NULL inside autocomplete_free

This commit is contained in:
James Booth 2014-09-26 00:48:48 +01:00
parent ccbaa67a01
commit a4f7932ed7
4 changed files with 7 additions and 11 deletions

View File

@ -1257,9 +1257,7 @@ cmd_uninit(void)
autocomplete_free(autoaway_mode_ac);
autocomplete_free(autoconnect_ac);
autocomplete_free(theme_ac);
if (theme_load_ac != NULL) {
autocomplete_free(theme_load_ac);
}
autocomplete_free(theme_load_ac);
autocomplete_free(account_ac);
autocomplete_free(account_set_ac);
autocomplete_free(account_clear_ac);

View File

@ -594,9 +594,7 @@ _free_room(ChatRoom *room)
if (room->roster) {
g_hash_table_destroy(room->roster);
}
if (room->nick_ac) {
autocomplete_free(room->nick_ac);
}
autocomplete_free(room->nick_ac);
if (room->nick_changes) {
g_hash_table_destroy(room->nick_changes);
}

View File

@ -80,8 +80,10 @@ autocomplete_reset(Autocomplete ac)
void
autocomplete_free(Autocomplete ac)
{
autocomplete_clear(ac);
free(ac);
if (ac) {
autocomplete_clear(ac);
free(ac);
}
}
gint

View File

@ -77,9 +77,7 @@ bookmark_request(void)
id = strdup("bookmark_init_request");
autojoin_count = 0;
if (bookmark_ac != NULL) {
autocomplete_free(bookmark_ac);
}
autocomplete_free(bookmark_ac);
bookmark_ac = autocomplete_new();
if (bookmark_list != NULL) {
g_list_free_full(bookmark_list, _bookmark_item_destroy);