Message-ID: <35CB1C54.ECBF9EB@unb.ca> Date: Fri, 07 Aug 1998 12:25:09 -0300 From: Endlisnis MIME-Version: 1.0 To: "Salvador Eduardo Tropea (SET)" CC: Grzegorz Adam Hankiewicz , djgpp AT delorie DOT com Subject: Re: How do I free the allocated memory? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Salvador Eduardo Tropea (SET) wrote: > 1) Don't allocate the memory before checking new_str. > > char *new_str; > > if (new_str == NULL) return NULL; > SET Isn't 'new_str' initalized to whatever happens to be in memory? Isn't the whole point to check to see if malloc was able to allocate the space? If so, how could you check for an error before the function is called? -- (\/) Endlisnis (\/) s257m AT unb DOT ca Endlisnis AT GeoCities DOT com Endlis AT nbnet DOT nb DOT ca