Issue information

Issue ID
#3911
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Dec 1, 2009 17:24
Last Post
Hercules Elf Bot
Dec 1, 2009 17:24
Confirmation
N/A

Hercules Elf Bot - Dec 1, 2009 17:24

Originally posted by [b]CuriousKitten[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3911

This is a re-post of previous a bug report...
(Shortened version)

Also in current trunk version. (not exactly sure the number, svn is down)

File: Unit.c
Function: Unit_free()
Ways to recreate...
1> Open NPC dialog and Force Terminate the server.
2> Open NPC dialog and have a client "timeout" without actually confirming the dialog.
Note: the TODO line is from the most recent trunk.


Add the "run_script_main" to tell the function to actually end the script because the client is long gone and the code isn't run.
CODE
        //Tell the script to end, not delete it, it will free itself when necessary [Kevin]
        // TODO review this assumption, possible source of memory leaks [FlavioJS]
        if( sd->st )
        {
            sd->st->rid = 0;
            sd->st->state = END;

            //Tell it to process its END [...]
            run_script_main(sd->st);        //(add this line)
        }



Would cause memory leaks like this...
CODE
Memory manager: Memory leaks found at 2009/11/07 11h09m32s (Revision Unknown).
0001 : script.c line 2959 size 48 address 0x0x7ff59240 created on 'Sat Nov  7 10:37:42 2009'
0002 : script.c line 2961 size 20 address 0x0x7ff7fd58 created on 'Sat Nov  7 10:37:42 2009'
0003 : script.c line 2964 size 768 address 0x0x7e81e74c created on 'Sat Nov  7 10:37:42 2009'
0004 : script.c line 2966 size 4 address 0x0x7e856138 created on 'Sat Nov  7 10:37:42 2009'


This post has been edited by CuriousKitten: Dec 1 2009, 09:25 AM