diff -r bc9a0fefd892 -r 5f43f733cc12 suffix_list.c --- a/suffix_list.c Tue Sep 20 15:19:28 2011 +0200 +++ b/suffix_list.c Thu Oct 06 00:06:30 2011 +0200 @@ -15,9 +15,16 @@ return suffixList; } +void destroy_suffix_list_t(suffix_list_t* list) { + if (list->items != NULL) { + free(list->items); + } + free(list); +} + void add_suffix(suffix_list_t* list, char* item) { char** reallocated_list = - realloc(list->items, sizeof(char*) * list->count + 1); + realloc(list->items, sizeof(char*) * (list->count + 1)); if (reallocated_list != NULL) { list->items = reallocated_list; list->items[list->count] = item;