A "simple" realloc() question.

Doug Dale ddale at csm9a.UUCP
Wed Jun 14 02:53:08 AEST 1989


	I am writing a program that dynamically allocates space to store 
strings, and I have a question that a large number of manuals and C books
won't answer for me.  When using realloc(), if it is necessary to move the
information to another location in memory because more memory is needed, is
the old memory freed?  
	I could simply check after calling realloc to see if the position has
changed, and then free the old area if necessary, but I seem to remember
hearing that freeing space that is already 'free' can be dangerous.  So it
might cause problems if realloc() does free memory, and then I try to free it
again.
	You would think that I could find such information in any C manual,
but...

						ddale at csm9a.colorado.EDU 



More information about the Comp.lang.c mailing list