I get a segmentation fault after free
ing a certain pointer:
free(studentDB->name);
I can get its value without any errors or warnings:
printf("[DBG] studentDB->name: %s\n", studentDB->name);
However, as I said, the program crashes when I try to free it. What are the most common causes for a free
command leading to a segmentation fault?
If you didn't malloc()
it, you can't free()
it. Where does studentDB->name
come from?