Freeing a buffer in a node.
I've used the free function to free an array that was part of a struct. However I got some segfaults when running the program, so I decided to print out the array to see what had happened to it.
I saw that the buffer had a mix of garbage values and part of the original string.
Essentially, I had called free like:
Code:
free(node->string);
then I did
Code:
printf("%s", node->string);
got garbage as a result. Isn't free() supposed to null whatever you are meant to be freeing?