Error in debugging "free(): double free detected in tcache 2"

60 Views Asked by At

I understand the meaning of this error: something was freed twice. But when I step through my code I can't see the logical/syntax error really. And I can't debug as this error prevents me from running my debugger. Here's my code, any thoughts?

This code is meant to free a hashmap I've created.

bool unload(void)
{
    for (int i = 0; i < N; i++)
    {
        while (table[i] != NULL)
        {
            node *temp = table[i]->next;
            free(table[i]);
            table[i] = temp;
        }
    }
    return true;
}
0

There are 0 best solutions below