cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/07/11:40:38

Message-ID: <35CB1C54.ECBF9EB@unb.ca>
Date: Fri, 07 Aug 1998 12:25:09 -0300
From: Endlisnis <s257m AT unb DOT ca>
MIME-Version: 1.0
To: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
CC: Grzegorz Adam Hankiewicz <gah AT jet DOT es>, djgpp AT delorie DOT com
Subject: Re: How do I free the allocated memory?
References: <m0z43Vz-000S4XC AT inti DOT gov DOT ar>

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



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019