Path: utzoo!attcan!uunet!van-bc!ubc-cs!alberta!mts.ucs.UAlberta.CA!Al_Dunbar From: userAKDU@mts.ucs.UAlberta.CA (Al Dunbar) Newsgroups: comp.lang.c Subject: Re: Life after free? Message-ID: <1381@mts.ucs.UAlberta.CA> Date: 28 Sep 90 03:10:50 GMT References: Organization: MTS Univ of Alberta Lines: 25 In article , quan@sol.surv.utas.oz (Stephen Quan) writes: >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@sol.surv.utas.edu.au) >University of Tasmania. You have, perhaps, a death-wish? -------------------+------------------------------------------- Al Dunbar | Edmonton, Alberta | this space for rent CANADA | -------------------+-------------------------------------------