Re: Oh man is this a bad one...

From: Hades (tourach@servtech.com)
Date: 05/09/96


> >   while (ch->affected)
> >     affect_remove(ch, ch->affected);
> > 
> >   free(ch);
> >   ch = NULL;
> > }
> > 
> > Those last 2 lines should kill the char outta memory, even if it leaves the
> > strings and such, right? Well.. I dunno... any help appreiciated.
> 
> That code is a mistake!
> 
> You must have added that "ch = NULL" to free_char() yourself because the
> last statement in the stock db.c's free_char() is simply "free(ch)".
> 
> ch is a parameter passed to free_char().  Since C is call-by-value, and not
> call-by-reference, setting ch = NULL within free_char() does *NOT* mean
> that the value of ch is changed in free_char()'s caller.
> 

well, free()ing ch should kill all memory of it, right? 5 mins later if I
check a pointer I set to the ch before I freed it, it still had the mobs
stats. It doesnt seem to be getting free'd. That's my main problem.



This archive was generated by hypermail 2b30 : 12/18/00 PST