diff options
author | greenboxal2 <greenboxal2@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-04-24 16:27:04 +0000 |
---|---|---|
committer | greenboxal2 <greenboxal2@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-04-24 16:27:04 +0000 |
commit | a5244368bb4c8887d900228658f4fa680222d0da (patch) | |
tree | 3b29ef1eb50674abb4005dda2b362675da5d43eb /src/map/mob.c | |
parent | 173905288bdb123e7c2249f9d05714acf2f1541a (diff) | |
download | hercules-a5244368bb4c8887d900228658f4fa680222d0da.tar.gz hercules-a5244368bb4c8887d900228658f4fa680222d0da.tar.bz2 hercules-a5244368bb4c8887d900228658f4fa680222d0da.tar.xz hercules-a5244368bb4c8887d900228658f4fa680222d0da.zip |
Fixed memory leak on MvP tomb system, killer name now uses static buffer. (bugreport:5615)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15954 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index a32ba3c64..6790d5e92 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -151,9 +151,9 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time) nd->u.tomb.kill_time = time; if (killer) - nd->u.tomb.killer_name = aStrdup(killer); // Don't rely that killer name will be available all time + safestrncpy(nd->u.tomb.killer_name, killer, NAME_LENGTH); else - nd->u.tomb.killer_name = NULL; + nd->u.tomb.killer_name[0] = NULL; map_addnpc(nd->bl.m, nd); map_addblock(&nd->bl); @@ -168,12 +168,7 @@ void mvptomb_destroy(struct mob_data *md) struct npc_data *nd = (struct npc_data *)map_id2bl(md->tomb_nid); if (nd) - { - if (nd->u.tomb.killer_name) - aFree(nd->u.tomb.killer_name); - npc_unload(nd); - } md->tomb_nid = 0; } |