I have the speller up and running, working properly and passing the cs50 automatic verification, but, independently of the size of the dictionary (even with a one word dictionary or an empty one) valgrind always tells me that I have one block that is definitely lost (52 bytes).
The leak is in the load function, precisely in the line that loads the dictionary into memory, which goes like this:
for (node* new_node = malloc(sizeof(node)); fscanf(dict, "%s",new_node->word) == 1; new_node = malloc(sizeof(node)))
Clearly this line is mallocing one node to many and I think I will have to create a temporary variable before the loop to temporary hold the word from the dictionary and then, inside the loop, copy it into the new_node->word.
But is there anyway I could make this work? It seems so much cleaner without having to use a temp variable.