summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-27 19:25:09 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-27 19:25:09 +0000
commit96c001d739119226d0670a9916c6d564a7cf0d22 (patch)
treeafdd95c1d843a60ce8a9ed85e2afec0c1b01fbe3 /src/map
parent8f3d851c422e444510b659a2f4f850cb5036e604 (diff)
downloadhercules-96c001d739119226d0670a9916c6d564a7cf0d22.tar.gz
hercules-96c001d739119226d0670a9916c6d564a7cf0d22.tar.bz2
hercules-96c001d739119226d0670a9916c6d564a7cf0d22.tar.xz
hercules-96c001d739119226d0670a9916c6d564a7cf0d22.zip
Memory leak fixes
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1006 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.c3
-rw-r--r--src/map/pet.c18
-rw-r--r--src/map/pet.h1
3 files changed, 17 insertions, 5 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 16a8d5905..50f44c327 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1094,6 +1094,8 @@ int map_quit(struct map_session_data *sd) {
}
strdb_erase(nick_db,sd->status.name);
numdb_erase(charid_db,sd->status.char_id);
+ free(sd->reg);
+ free(sd->regstr);
return 0;
}
@@ -2626,6 +2628,7 @@ void do_final(void) {
do_final_itemdb();
do_final_storage();
do_final_guild();
+ do_final_pet();
/*
for(i=0;i<map_num;i++){
if(map[i].gat) {
diff --git a/src/map/pet.c b/src/map/pet.c
index 759e2d11b..c50e76087 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -610,6 +610,7 @@ int pet_remove_map(struct map_session_data *sd)
pet_hungry_timer_delete(sd);
clif_clearchar_area(&sd->pd->bl,0);
map_delblock(&sd->pd->bl);
+ free(sd->pd->lootitem);
map_deliddb(&sd->pd->bl);
}
return 0;
@@ -653,7 +654,8 @@ int pet_return_egg(struct map_session_data *sd)
Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd);
if(sd->status.pet_id && sd->pd) {
- struct pet_data *pd=sd->pd;
+ // ルートしたItemを落とさせる
+ pet_lootitem_drop(sd->pd,sd);
pet_remove_map(sd);
sd->status.pet_id = 0;
sd->pd = NULL;
@@ -677,8 +679,6 @@ int pet_return_egg(struct map_session_data *sd)
else
status_calc_pc(sd,2);
}
- // ルートしたItemを落とさせる
- pet_lootitem_drop(pd,sd);
intif_save_petdata(sd->status.account_id,&sd->pet);
pc_makesavestatus(sd);
@@ -1382,8 +1382,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
else
add_timer(gettick()+540+i,pet_delay_item_drop2,(int)ditem,0);
}
- pd->lootitem=NULL;
- pd->lootitem=(struct item *)aCalloc(PETLOOT_SIZE,sizeof(struct item));
+ memset(pd->lootitem,0,LOOTITEM_SIZE * sizeof(struct item));
pd->lootitem_count = 0;
pd->lootitem_weight = 0;
pd->lootitem_timer = gettick()+10000; // 10*1000msの間拾わない
@@ -1701,3 +1700,12 @@ int do_init_pet(void)
return 0;
}
+int do_final_pet(void) {
+ int i;
+ for(i = 0;i < MAX_PET_DB; i++) {
+ if(pet_db[i].script) {
+ free(pet_db[i].script);
+ }
+ }
+ return 0;
+}
diff --git a/src/map/pet.h b/src/map/pet.h
index 1664f42d5..425bc6887 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -64,6 +64,7 @@ int pet_heal_timer(int tid,unsigned int tick,int id,int data); // [Valaris]
int pet_skillattack_timer(int tid,unsigned int tick,int id,int data); // [Valaris]
int do_init_pet(void);
+int do_final_pet(void);
#endif