Re: Extraction Crash

From: Sean Butler (sbutler@DEVEAST.COM)
Date: 10/20/97

From:   John Evans[SMTP:evansj@HI-LINE.NET]
I am having a problem with a crash-bug here. It happens when an object is
extracted via the 'R' zone command for removing an object. I can purge
and junk objects just fine, but as soon as the game tries to remove one,
it crashes... Here is the gdb and code.

(gdb) p temp->next
Cannot access memory at address 0x290813d8.
(gdb) p temp
$1 = (struct obj_data *) 0x29081338
(gdb) p temp->name
Cannot access memory at address 0x290813ac.
(gdb) quit

Notice that temp->next is unaccessable for some reason. Look at the code
and tell me if you can spot why...

  if (obj == object_list)
    object_list = obj->next;
  else {
    temp = object_list;
    while (temp && (temp->next != obj))
      temp = temp->next;
    if (temp)
      temp->next = obj->next;

> Well, the best I can offer is that you do not test for
> the null condition of temp->next.  Thus you are probably
> seg faulting here. Try:
>  while (temp && temp->next && (temp->next != obj))
> Not sure this is it, but its a good idea to always check
> for the NULL condition anyway.
> --Sean

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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