New answers tagged valgrind
0
In your unload function, you check if the cursor is zero. Instead you should check if the cursor is NULL. So the condition for the while loop should be cursor != NULL. The valgrind error states line 77 in dictionary.c, which is node *n = malloc(sizeof(node)). To fix this problem, declare n outside the while loop as node *n = NULL. Then inside the loop, do n =...
Top 50 recent answers are included
Related Tags
valgrind × 198pset5 × 134
speller × 89
memory-leak × 35
unload × 24
load × 22
pset4 × 21
dictionary × 14
cs50x × 13
trie × 12
memory × 12
recover × 10
check50 × 10
segmentation-fault × 10
pset6 × 9
free × 9
c × 8
error × 7
check × 5
malloc × 4
server × 3
resize × 2
pointers × 2
hash-table × 2
fails-check50-but-works × 2