FFlist: add tests

This commit is contained in:
李通洲
2022-09-20 22:45:36 +08:00
parent 6eed53217d
commit e5b110375f
3 changed files with 101 additions and 2 deletions
+4 -2
View File
@@ -46,6 +46,8 @@ uint32_t ffListFirstIndexComp(const FFlist* list, void* compElement, bool(*compF
void ffListDestroy(FFlist* list)
{
if(list->data != NULL)
free(list->data);
//Avoid free-after-use. These 3 assignments are cheap so don't remove them
list->capacity = list->length = 0;
free(list->data);
list->data = NULL;
}