free'ing malloc'd structure with malloc'd members

From: John (iamlevi3_at_hotmail.com)
Date: 07/30/04


Date: Thu, 29 Jul 2004 23:32:10 -0400

In the course of an assignment, I learned the hard way that I shouldn't try
to free a malloc'd member of a malloc'd structure after having freed that
structure (i.e., free( structure ); free( structure->bufferspace ) ).

My question is, if I free just the structure, will the (e.g.) bufferspace be
freed implicitly, or do I have to (as I currently am) free the members
first?

Thanks.
-cjl