Can't pass valgrind test on pset4 speller (hashtable). The speller works perfectly but, I'm getting this message from valgrind:
==3911== ==3911== HEAP SUMMARY: ==3911== in use at exit: 32 bytes in 1 blocks ==3911== total heap usage: 143,097 allocs, 143,096 frees, 8,023,448 bytes allocated ==3911== ==3911== LEAK SUMMARY: ==3911== definitely lost: 0 bytes in 0 blocks ==3911== indirectly lost: 0 bytes in 0 blocks ==3911== possibly lost: 0 bytes in 0 blocks ==3911== still reachable: 32 bytes in 1 blocks ==3911== suppressed: 0 bytes in 0 blocks ==3911== Reachable blocks (those to which a pointer was found) are not shown. ==3911== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==3911== ==3911== For counts of detected and suppressed errors, rerun with: -v ==3911== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
I have check the places where I allocate memory 1) creating the hashtables and 2) opening the dictionary, but still there is a block reachable and to check for this I have done the following:
1) I placed a counter right next to malloc when creating the nodes for the hashtable and the counter shows 143091 for the large dictionary. Then I placed a counter within unload() to check how many nodes I free overthere and I get the same number 143091.
2) I checked that the fclose is placed correctly and should be executed without problem.
I just don't know where else to look.
here is my code to dictionary.c