Ok, I am having a bizzare problem. Whenever a new player is created and
enters, joins a class, then quits, I get a crash. It always crashes at
the same point in this function.
/* release memory allocated for a char struct */
void free_char(struct char_data * ch)
{
int i;
struct alias *a;
void free_alias(struct alias * a);
if (ch->player_specials != NULL && ch->player_specials != &dummy_mob) {
while ((a = GET_ALIASES(ch)) != NULL) {
GET_ALIASES(ch) = (GET_ALIASES(ch))->next;
free_alias(a);
}
log("Aliases freed");
if (ch->player_specials->poofin)
free(ch->player_specials->poofin);
if (ch->player_specials->poofout)
free(ch->player_specials->poofout);
log("Poofs freed");
/* ****************** */
/* CRASHES RIGHT HERE */
/* ****************** */
free(ch->player_specials);
log("Specials freed");
if (IS_NPC(ch))
log("SYSERR: Mob had player_specials allocated!");
}
if (!IS_NPC(ch) || (IS_NPC(ch) && GET_MOB_RNUM(ch) == -1)) {
log("PC");
/* if this is a player, or a non-prototyped non-player, free all */
if (ch->player.name)
free(ch->player.name);
log("name freed");
if (ch->player.title)
free(ch->player.title);
log("title freed");
if (ch->player.short_descr)
free(ch->player.short_descr);
log("short freed");
if (ch->player.long_descr)
free(ch->player.long_descr);
log("long freed");
if (ch->player.description)
free(ch->player.description);
log("desc freed");
if (ch->player.dname)
free(ch->player.dname);
log("disguise freed");
} else if ((i = GET_MOB_RNUM(ch)) > -1) {
/* otherwise, free strings only if the string is not pointing at
proto */
if (ch->player.name && ch->player.name != mob_proto[i].player.name)
free(ch->player.name);
if (ch->player.title && ch->player.title != mob_proto[i].player.title)
free(ch->player.title);
if (ch->player.short_descr && ch->player.short_descr !=
mob_proto[i].player$
free(ch->player.short_descr);
if (ch->player.long_descr && ch->player.long_descr !=
mob_proto[i].player.l$
free(ch->player.long_descr);
if (ch->player.description && ch->player.description !=
mob_proto[i].player$
free(ch->player.description);
if (ch->player.dname && ch->player.dname != mob_proto[i].player.dname)
free(ch->player.dname);
}
while (ch->affected)
affect_remove(ch, ch->affected);
log("affects freed");
free(ch);
log("ch freed");
}
As you can see, I added ina few logs to track down exactly when it
crashes. I get the poofs freed message, and then it crashes. (that's
the last thing I get) I am guessing that there is SOMETHING in the
player_specials that is crashing it, so I included what mine is from the
structs.h file. The player_special_data_saved is also there. Any help
or suggestions would be appreciated.
struct player_special_data {
int advance;
struct player_special_data_saved saved;
char *poofin; /* Description on arrival of a god. */
char *poofout; /* Description upon a god's exit. */
struct alias *aliases; /* Character's aliases */
long last_tell; /* idnum of last tell from */
void *last_olc_targ; /* olc control */
int last_olc_mode; /* olc control */
};
struct player_special_data_saved {
byte skills[MAX_SKILLS+1]; /* array of skills plus skill 0 */
byte hearing;
bool talks[MAX_TONGUE]; /* PC s Tongues 0 for NPC */
int wimp_level; /* Below this # of hit points, flee! */
byte freeze_level; /* Level of god who froze char, if any */
sh_int invis_level; /* level of invisibility */
room_num load_room; /* Which room to place char in */
long pref; /* preference flags for PC's. */
ubyte bad_pws; /* number of bad password attemps */
sbyte conditions[3]; /* Drunk, full, thirsty */
/* spares below for future expansion. You can change the names from
'sparen' to something meaningful, but don't change the order. */
ubyte spoken;
ubyte soak;
ubyte warmth;
ubyte real_con;
ubyte spare4;
ubyte restore;
int spells_to_learn;
int race;
int familiar;
int starve;
int as_rnum;
int as_room;
int thirst;
int stoneskin;
int images;
int purity;
int quest;
long aff1;
long aff2;
long aff3;
long wanted;
long medals;
};
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
| Or send 'info circle' to majordomo@cspo.queensu.ca |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST