Re: Stock Circle Bug

From: Edward Almasy (almasy@axisdata.com)
Date: 01/19/97


Daniel Koepke writes:
> On Sun, 19 Jan 1997, Greymalk wrote:
> >     if (ch->player.short_descr)
> >       free(ch->player.short_descr);
> > 
> > (The third and fourth lines are the only ones modified.)  This change
> > should avoid the double deallocation.
> > 
> > If a problem with the above fix becomes apparent to anyone or if the bug
> > is not present in stock Circle, please let me know.
> 
> I would think that the 'if' would prevent the second deallocation.

The NULL pointer ('if') checks only prevent the deallocation if the
pointer is set to NULL (zero in most architectures).  The call to free()
just deallocates the memory -- it doesn't change the pointer at all, so
the 'if' check doesn't prevent anything.

Greymalk
The Ninth Circle
greymalk@axisdata.com


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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