1
Looks like your program leaked 1,120 bytes of memory. Did you forget to free memory that you allocated via malloc? Take 
a closer look at line 48 of dictionary.c.

Its weard because i am freeing the memory but its saying there's leak.

bool check(const char *word)
{
    node *checker = malloc(sizeof(node));
    // determine in which index(bucket) is the word
    int index = hash(word);
    checker = hashtable[index];

    while(checker != NULL)
    {
        // checker is case insensitive
        if(strcasecmp(checker->word, word) == 0)
            return true;
        checker = checker->next;  
    }
    free(checker);
    return false;
}

Line 48 : node *checker = malloc(sizeof(node));

2

Why are you mallocing space in check?

Also, your free(checker) only runs if the word is not found. How about when the word is found? You return true and the function ends, so that free line is never reached.

You must log in to answer this question.

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