==11661== Invalid free() / delete / delete[]
==11661== at 0x400513F: free (vg_replace_malloc.c:233)
==11661== by 0x406A3B5: fclose@@GLIBC_2.1 (iofclose.c:88)
==11661== by 0x80AE2AD: save_char_obj (save.c:142)
==11661== by 0x804B3D3: do_save (act_comm.c:2650)
==11661== by 0x8099705: interpret (interp.c:621)
==11661== by 0x8072D77: substitute_alias (alias.c:72)
==11661== by 0x807B74B: game_loop_unix (comm.c:894)
==11661== by 0x807BC24: main (comm.c:449)
==11661== Address 0x4252A18 is 0 bytes inside a block of size 352 free'd
==11661== at 0x400513F: free (vg_replace_malloc.c:233)
==11661== by 0x406A3B5: fclose@@GLIBC_2.1 (iofclose.c:88)
==11661== by 0x80AC400: load_char_reroll (save.c:829)
==11661== by 0x8078303: nanny (comm.c:2125)
==11661== by 0x807B75F: game_loop_unix (comm.c:898)
==11661== by 0x807BC24: main (comm.c:449)
Backstory:
I have decided to start a new mud as a side project. It has been years since I worked on muds, and my memory is beyond rusty. I decided to revamp an old project from scratch. Premise is a PK mud with 3 tiers on a RoT codebase (yeah - I realize it's been done, but that is the only relevant information to this situation). I had obtained a copy of rot 1.4 with OLC … added all my races and classes - and then added my code for tier 3 classes, and was having difficulty getting the game to compile. So I stripped out the code for tier 3 and left in the classes. Game compiled and I used my IMP character to "advance" a new character to hero. Then I used the reroll function. Everything worked as expected … that is until the rerolled character saved, then *crash* …
I had the shell open and received a large scrolling amount of text that started with *****glibc error**** double free or corruption. (i'll post actual details below). So I was like - "crap I broke it" … so I started from scratch - no changes this time, and tested hoping to see a perfect reroll. Everything was great - until saving the rerolled character … then *crash*. I went out and got a copy of the RoT sourcecode that was cleaned for gcc4 (I had been using gcc2.95.3 in my Makefile and had many warnings on compiling). So with a different and fresh source code I check - advance, reroll, save - crash.
I have tried four different variants of the RoT source code - with and without OLC, cleaned for gcc4 and not … and all result in the same glibc error.
Issue:
After a character has reached 101 (actually not by reaching, to be more specific, by being advanced to 101), I have it reroll. After reroll I get a glibc error. This happens whether the character types "save" or whether the worlds auto saves … it also occurs if the character tries to reroll a second time prior to the game saving. Basically any rerolled character seems to crash the mud whenever the system tries to save over the old player file. Save does not occur at all, as when the mud comes back from crash and player enters they start from the create a tier 2 character script. (I did notice that the script for reroll has the prompt jacked up and it reads "%hhp" instead of the "100hp" it should, but the glibc error occurs whether I correct this or not)
Here is the detail of what I am getting:
[USERNAME@server]$ ***glibc detected *** ./rot: double free or corruption (!prev): 0x08af24f8 ***
======= Backtrace: ========
/lib/i686/nosegneg/libc.so.6 [x281651]
/lib/i686/nosegneg/libc.so.6(cfree+0x90)[0x284cd0]
/lib/i686/nosegneg/libc.so.6(fclose+0x136)[0x26fda6]
./rot [0x80ae2ae]
./rot [0x804b3d4]
./rot [0x8099706]
./rot [0x8072d78]
./rot [0x807b74c]
./rot [0x807bc25]
/lib/i686/nosegneg/libc.so.6(__libc_start_main+0xe0)[0x22d390]
./rot[0x8048d51]
======= Memory map: =======
001f8000-00213000 r-xp 00000000 fd:00 98470 /lib/ld-2.7.so
the memory map stuff goes on for about 20 lines (not sure if it was needed, if so let me know and I can post the rest of it
and it ends with a final line that reads
bfb55000-bfb6b000 rw-p bfb55000 00:00 0 [stack]
Abort (core dumped)
So that is what I get. I really don't want to run without a second tier (as I said I wanted three), but if I can't fix this I am going to have to dump the reroll. However, like I said this is a stock sourcecode doing this - and one that has been around a long time, so I am really hoping that someone else has seen this and it correctable by an entry level mud coder.
Thanks for any help or insight.
Sorano