I believe its crashing on the saving.
The main parts of the core, that are useful, are these:
#5 0x400d4da1 in free () from /lib/libc.so.6
#6 0x081c5980 in discard_editdata (edd=0x8867e80) at editor.c:150
#7 0x081c618c in stop_editing (ch=0x88a9c30) at editor.c:391
#8 0x080ae631 in do_redit (ch=0x88a9c30, argument=0x8238c97 "" at build.c:4218
#9 0x081c728c in editor_save (ch=0x88a9c30, edd=0x8867e80, argument=0xbffff5c6 "" at editor.c:959
#10 0x081c6506 in edit_buffer (ch=0x88a9c30, argument=0xbffff5c6 "" at editor.c:468
#11 0x080cfc6f in game_loop () at comm.c:732
In game_loop the character was transfered to edit_buffer (because they are in editing).
Then /s (or whatever the code uses to save the info) was done.
It then passed it to editor_save which then returns it to do_redit.
In do_redit it calls for stop_editing which called discard_editdata.
So what you should mainly check out is the part in discard_editdata at the line specified to see whats wrong there.
Considering the info from 0-5 is mainly system functions not to much you can do about them.
I would say that the line shown in #6 needs to check for valid data or something.
The data seems to have already been freed at that point, sometimes its done in other functions like the main ones calling that function, but its a good starting point. Look to make sure its not freed more then once.
Hope that helps at least a little, hard to say without all the code in front of us for testing