Life after free?

Stephen Quan quan at sol.surv.utas.oz
Thu Sep 27 14:37:36 AEST 1990


char *funny(ch)
char ch;
{
  char *tmp;
  int i;
  
  tmp = (char *) malloc(100);
  for (i=0; i<=99 ; i++) *(tmp+i) = ch;
  free(tmp);
  return tmp;
}

Any comments on free-ing tmp before it is return-ed?

Stephen Quan (quan at sol.surv.utas.edu.au)
University of Tasmania.



More information about the Comp.lang.c mailing list