0

I have been having a problem with PSET5 in unload, where it is giving me an error:

* Error in `/home/ubuntu/workspace/pset5/speller': free(): invalid next size (fast): 0x00000000006042d0 *

Child terminated with signal = 0x6 (SIGABRT)
GDBserver exiting

Does anyone know what this means? And how I should fix it? Here is my code for unload:

bool unload(void)
{
    for (int i = 0; i < 26; i++) {
        while (root[i] != NULL) {
            node* tmp = root[i];
            root[i] = root[i]->next;
            if (root[i] != NULL) {
                printf("%s\n",root[i]->word);
                free(tmp);
            }
        }
    }
    return true;

}

0

Seems a problem with your if condition. It looks extra.. Try after removing it.

2
  • It still gives the same error.
    – Kyza
    Mar 23 '16 at 16:35
  • What about your buckets.. Are they 25 i.e <26?.. If not you must change your for loop. Mar 23 '16 at 16:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .