Impact: Fix memory corruption
autocomplete_tail needs to be NULLed when freeing the list of
autocomplete tokens or autocomplete_add_token_to_list can get really
confused when starting a new list.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
autocomplete_head = tmp;
}
autocomplete_backlog = 0;
+ autocomplete_tail = NULL;
autocomplete_last_seen = NULL;
}
/* Cycle through the list */
autocomplete_last_seen = autocomplete_last_seen->next;
- if (autocomplete_last_seen == NULL) {
+ if (autocomplete_last_seen == NULL)
autocomplete_last_seen = autocomplete_head;
- }
} else {
more_printf("\n");
autocomplete(skipspace(hdt_cli.input));