Hi. I'm pretty sure I'm doing nothing wrong, but thought I'd ask anyway.
We have:
struct some_struct **array_of_ptrs = calloc (num, sizeof (struct some_struct*));
Now assume I just point each of these pointers in the 'array' to a struct some_struct
. Now surely to free up the memory, I just do:
free (array_of_ptrs);
Surely this is perfectly acceptable? The reason I ask is because I am doing something similar in my code and gdb is complaining of a free error.