[CODE] free() issues

From: Deja Augustine (PraetorXI@aol.com)
Date: 09/05/00


Okay, I'm having a rather interesting problem.  I saw a topic on this that
dates back to May of '98, however there was not solution posted that I could
find...

Basically, since I've tried to implement poof saves into a modified bpl17 w/
OLC 2.0, I get a major issue with the stock code whenever it tries to free()
the poofin/poofout char pointers in the player_specials structure.  I haven't
moved them.  All I've done is to add poofin[] and poofout[] fixed sized
arrays to the char_file_u and tried both converting the pfile and actually
wiping the pfile.  Then, the only changes I made were to add code to db.c in
order to save/load the poofs themselves.

Since I did that, the MUD would crash everytime I would use the do_poofset
function, so I rewrote the whole damn thing w/o using free() and it works
perfectly.  However, in free_char() it still crashes the MUD when it tries to
free() those two pointers.  So, basically the MUD crashes EVERYTIME someone
quits the game.

Anyway, my backtrace looks very similar to PjD's :

#0  0x4009ff93 in __libc_free (mem=0xbfffef40) at malloc.c:3012
#1  0x8074881 in free_char (ch=0x8108fd0) at db.c:2297
#2  0x806dccb in close_socket (d=0x8106a28) at comm.c:1864
#3  0x806c561 in game_loop (mother_desc=3) at comm.c:753
#4  0x806bb28 in init_game (port=1337) at comm.c:355
#5  0x806baa5 in main (argc=2, argv=0xbffffbe4) at comm.c:319

and when I examined frame #0 I got:
#0  0x4009ff93 in __libc_free (mem=0xbfffef40) at malloc.c:3012
3012    malloc.c: No such file or directory.

and frame #1 yielded:
#1  0x8074881 in free_char (ch=0x8108fd0) at db.c:2297
2297          free(ch->player_specials->poofin);

One more time, I've checked and re-checked, and there IS a char* poofin; in
the player_special_data struct.  I'm at a total loss...

-Praetor
(BTW, some of you may remember me from before...I'm back!!)


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



This archive was generated by hypermail 2b30 : 04/11/01 PDT