Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ crashing as chars log off..

crashing as chars log off..

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Typhon   USA  (112 posts)  Bio
Date Tue 25 Jun 2002 03:22 PM (UTC)
Message
its seems that when i put in the hometowns code by noplex when players go to logg off it kills the mud.. i think its trying to free somethign that doesnt exsist as the exit but i dont know where to look for that typ of thing.. i know ive changed it before for other snippets and such but i just cant seem to remember where.. if anyone know it'd be helpful
thanks -typ
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 28 Jun 2002 06:07 AM (UTC)
Message
Try using gdb (the debugger) to see why it is crashing. Search for gdb on this forum for some examples of using it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #2 on Sat 29 Jun 2002 01:38 PM (UTC)
Message
ok ive used the gdb debugger and it seems thats im getting a BUG: Freeing null pointer db.c:2913
STRFREEing NULL in db.c, line 2913
/* Free Hometown Stuff -Nopey */
STRFREE( ch->pcdata->htown_name );
if( ch->pcdata->hometown )
{
STRFREE( ch->pcdata->hometown->name );
STRFREE( ch->pcdata->hometown->filename ); //this line
DISPOSE( ch->pcdata->hometown );
}

in pc_data there are the lines..
char * htown_name;
HOMETOWN_DATA *hometown;

and the hometown_data structure is
struct hometown_data
{
HOMETOWN_DATA *next;
HOMETOWN_DATA *prev;
char *name;
char *filename;
int recall;
};

im assuming something is all screwy in there but how would i go about checking what exactly is goin on there thats making it die.
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #3 on Sat 29 Jun 2002 01:50 PM (UTC)
Message
ok a little update...
this char that i made (jon) is a newcreated char.. with the hometown selected when he created.. for any other char its fine they can log on and off but with jon when i go to log off i get that strfree null stuff.
where i was getting that error in db.c i put in bugs to display the name of the filename and what not that was causing the crash. well heres the code i put in and what i got in return
if( ch->pcdata->hometown )
{
bug("%s",ch->pcdata->hometown->name);
STRFREE( ch->pcdata->hometown->name );
bug("%s",ch->pcdata->hometown->filename);
STRFREE( ch->pcdata->hometown->filename );
DISPOSE( ch->pcdata->hometown );
}
Sat Jun 29 09:44:15 2002 :: Jon has quit (Room 10385).
Sat Jun 29 09:44:15 2002 :: [*****] BUG:
Sat Jun 29 09:44:15 2002 :: [*****] BUG: (null)
Sat Jun 29 09:44:15 2002 :: [*****] BUG: Freeing null pointer db.c:2915
STRFREEing NULL in db.c, line 2915
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 02 Jul 2002 11:42 PM (UTC)
Message
It seems pretty clear from both the original crash and your debugging that the field ch->pcdata->hometown->filename is NULL (ie. zero).

When you create a hometown you should put something into that field, alternatively check it is not null before you free it, like this:


if (ch->pcdata->hometown->filename)
  STRFREE( ch->pcdata->hometown->filename );

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Typhon   USA  (112 posts)  Bio
Date Reply #5 on Wed 03 Jul 2002 12:26 AM (UTC)
Message
well all in all it seemed easier to rewrite the whole hometown thing so thats what im nthe process of doing :-p i did like the hometown code by noplex but there were a bunch of glitchs i had to go find.. it seems as if it would work on a stock smaug mud fhowever im not running a stock one at this point :-p thanks for you help
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,721 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.