summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
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);