summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-09 14:11:02 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-09-09 14:11:02 +0000
commit49000e689a2516db20060d88871762f5a3bcac39 (patch)
treeef5ec52daf2c0a2d6bb6c83e5ca393593cbbeed6 /src/map/npc.c
parent8e131391349af474197f909bcad4ac3520fa1045 (diff)
downloadhercules-49000e689a2516db20060d88871762f5a3bcac39.tar.gz
hercules-49000e689a2516db20060d88871762f5a3bcac39.tar.bz2
hercules-49000e689a2516db20060d88871762f5a3bcac39.tar.xz
hercules-49000e689a2516db20060d88871762f5a3bcac39.zip
- Fixed a npc-timer memory leak on npc_unload ("[Warning]: ers_obj_destroy: X entries missing, continuing destruction. Manager for entries of size 16.")
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8686 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 6971313c8..9c3b4f096 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1431,8 +1431,13 @@ int npc_unload (struct npc_data *nd)
}
if (nd->bl.subtype == SCRIPT) {
ev_db->foreach(ev_db,npc_unload_ev,nd->exname); //Clean up all events related.
- if (nd->u.scr.timerid != -1)
+ if (nd->u.scr.timerid != -1) {
+ struct TimerData *td = NULL;
+ td = get_timer(nd->u.scr.timerid);
+ if (td && td->data)
+ ers_free(timer_event_ers, (struct event_timer_data*)td->data);
delete_timer(nd->u.scr.timerid, npc_timerevent);
+ }
npc_cleareventtimer (nd);
if (nd->u.scr.timer_event)
aFree(nd->u.scr.timer_event);