Sfoglia il codice sorgente

- 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://svn.code.sf.net/p/rathena/svn/trunk@8686 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 18 anni fa
parent
commit
2b63a85789
2 ha cambiato i file con 10 aggiunte e 1 eliminazioni
  1. 4 0
      Changelog-Trunk.txt
  2. 6 1
      src/map/npc.c

+ 4 - 0
Changelog-Trunk.txt

@@ -3,6 +3,10 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2006/09/09
+	* Fixed a npc-timer memory leak on npc_unload ("[Warning]: ers_obj_destroy:
+	  X entries missing, continuing destruction. Manager for entries of size
+	  16.") [Skotlex]
 2006/09/08
 	* Unified the rest and ganster paradise code into a single function.
 	  [Skotlex]

+ 6 - 1
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);