From: Ian D Romanick Message-Id: <199701081652.IAA27192@xavier.cs.pdx.edu> Subject: Re: free() question To: djgpp AT delorie DOT com Date: Wed, 8 Jan 1997 08:52:42 -0800 (PST) In-Reply-To: from "Eli Zaretskii" at Jan 8, 97 01:38:58 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > On Wed, 8 Jan 1997, Dim Zegebart wrote: > > > ptr1=(char*)malloc(sizeof(char)*1024); > > if (ptr1!=NULL) ptr2=ptr1; > > .... > > > > //so my question. May i use > > free(ptr2); > > //or i have to use > > free(ptr1) > > Both are OK. I wouldn't put it quite that way. *Either* is ok. Doing both is quite incorrect as it would free the same memory twice. :) -- "By that marker, configuring Citadel is actually impossible because it involves actually EDITING TEXT FILES. Editing text files, in the eye of the general public, requires a bachelors degree in computer science, even though you and I did it when we were eleven." -- Steven Frank