diff options
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 5ca96d587..effc36a4e 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1763,6 +1763,8 @@ void npc_unload_duplicates(struct npc_data* nd) { //Removes an npc from map and db. //Single is to free name (for duplicates). int npc_unload(struct npc_data* nd, bool single) { + unsigned int i; + nullpo_ret(nd); npc->remove_map(nd); @@ -1850,6 +1852,15 @@ int npc_unload(struct npc_data* nd, bool single) { nd->ud = NULL; } + for( i = 0; i < nd->hdatac; i++ ) { + if( nd->hdata[i]->flag.free ) { + aFree(nd->hdata[i]->data); + } + aFree(nd->hdata[i]); + } + if( nd->hdata ) + aFree(nd->hdata); + aFree(nd); return 0; |