Re: Problems (again) with stop_follower

From: George Greer (greerga@circlemud.org)
Date: 10/07/02


On Mon, 7 Oct 2002, Mathew Earle Reuther wrote:

>      if (ch->followers != NULL) {
>        for (k = ch->followers; k; k = k->next) {
>          if (PRF_FLAGGED(k->follower, PRF_AUTOASSIST) &&
>            (k->follower->in_room == ch->in_room))
>            do_assist(k->follower, GET_NAME(ch), 0, 0);
>        }
>      }
[..]
>Now, could all of the issues I've had have simply been not checking for a
>NULL?  From what I've read it seems so . . . but I had this issue before,
>and I didn't have autoassist code in that time (I think . . . god it's
>hard to keep track of everything!)

The 'for' loop already checks for NULL ("; k;") before processing, so
that's not it.  More likely is that your new code slightly changed the code
generation of your compiler so whatever is now being corrupted instead
isn't as important.

Run your code through ElectricFence, Purify, a bounds-checking compiler, or
some debugging malloc() package.

A crash bug with OasisOLC on 'free(mob_proto);' back in the day was solved
by making the castle.c code not write to mob_index[-1].  So your crash may
have absolutely nothing to do with the actual cause.  The OasisOLC problem
I mentioned above was fortunately not too hard to debug because the crash
on 'free(mob_proto);' was consistent, so I just made it prematurely free
the mob_proto[] structure during the boot-up sequence until it started
crashing because I freed the structure instead of crashing because of
corruption.  A binary search led to the castle.c code, and the fix.

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT