free'ing malloc'd structure with malloc'd members
From: John (iamlevi3_at_hotmail.com)
Date: 07/30/04
- Next message: Martin Ambuhl: "Re: free'ing malloc'd structure with malloc'd members"
- Previous message: Magix: "Bitwise operation"
- Next in thread: Martin Ambuhl: "Re: free'ing malloc'd structure with malloc'd members"
- Reply: Martin Ambuhl: "Re: free'ing malloc'd structure with malloc'd members"
- Reply: Emmanuel Delahaye: "Re: free'ing malloc'd structure with malloc'd members"
- Reply: Karthik: "Re: free'ing malloc'd structure with malloc'd members"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Martin Ambuhl: "Re: free'ing malloc'd structure with malloc'd members"
- Previous message: Magix: "Bitwise operation"
- Next in thread: Martin Ambuhl: "Re: free'ing malloc'd structure with malloc'd members"
- Reply: Martin Ambuhl: "Re: free'ing malloc'd structure with malloc'd members"
- Reply: Emmanuel Delahaye: "Re: free'ing malloc'd structure with malloc'd members"
- Reply: Karthik: "Re: free'ing malloc'd structure with malloc'd members"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]