On Tue, 23 Feb 1999, Glynn Clements wrote:

> In this case, it doesn't matter. All memory will be freed when the
> program terminates. In general, an application should free() the data
> once it has finished with it.

 So, foo() function could be called several times that the memory will be
freed when the program terminates !?

 Conclusion: it's only needed to free() memory when the function doesn't 
return the memory allocation !?

example:

int foo()
{
  int a ;
  char *b ;

  b = malloc(3*sizeof(char)) ;
  .
  . . .
  .
  free(b) ;

  a = 2 ;
  return a ;
}

 Only in this cases it will be needed to free() memory !?

 Thanks.

 Best regards,
    Nuno Carvalho

���������������������������������
   Nuno Emanuel F. Carvalho
 Dep. Informatics Engineering
    University of Coimbra

  PGP key available at finger
���������������������������������

Reply via email to