free()

Mohsen Pahlevanzadeh mohsen@pahlevanzadeh.org
Sun Sep 27 12:02:00 GMT 2009


Dear Steffen & all,
According to your description, i wrote following func & it work well:
///////////////////////////////////////////////////////
void safe_free(void * p){
        p = 0;
        free(p);
}//end of safe_free func
///////////////////////////////////////////////////////
Thank you.

On Sun, 2009-09-27 at 11:37 +0200, Steffen Wendzel wrote:
> You have to zero the memory it before, like I described here:
> 
> http://www.wendzel.de/dr.org/libcmle/examples/mem.html
> 
> Steffen
> 
> On Sun, 27 Sep 2009 00:18:00 +0330
> Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> wrote:
> 
> > Dear all,
> > We are working on C code (not ++),So we must use free instead delete.
> > I have following code:
> > /////////////////////////////////
> >         struct linked_list *p;
> > 	p->src="10.0.0.1";
> >         free(p);
> >         printf ("%s",p->srcip);
> > /////////I see in my output 10.0.0.1 
> > My question: i drop p pinter, but see it's value, how i kill p with its
> > value?
> > 
> > Yours,
> > Mohsen
> > 
> 
> 




More information about the Gcc-help mailing list