Re: [ Code ] My previous post...

From: Ron Cole (roncole@SHORE.INTERCOM.NET)
Date: 07/31/97


>If what you mean is that free(ch); ch = NULL; is not giving you a NULL ch
>afterwards, you've got some other code that's causing problems.  Try
>setting a breakpoint after the ch = NULL; and stepping through the code
>to see where it's changing.

I think a macro was used, so if you do the following, it'll break:

if (test)
  FREE(ch);

ch would be freed if (test) is true, and ch set to NULL reguardless...

Maybe the macro needs braces around it or something if you want to do it that
way.  Or write you own free and pass the address of the point so you can clear
it.  Something like this, maybe?  (not sure)

void *my_free(void *ch)
{
  free(ch);
  return ch = NULL;
}

Then change all your free calls to:

ch = my_free(ch);

Ron


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



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