Thread: Memory leaks
View Single Post
  #5  
Old 08-27-2009, 05:59 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Here's a fix for a smaller leak based on the logs:

Code:
 14 bytes in 1 blocks are definitely lost in loss record 5 of 55
    at 0x402209E: operator new[](unsigned) (vg_replace_malloc.c:268)
    by 0x817BC51: Database::GetZoneLongName(char const*, char**, char*, float*, float*, float*, unsigned*, unsigned*) (database.cpp:1112)
    by 0x82C9A81: Client::ZonePC(unsigned, unsigned, float, float, float, float, unsigned char, ZoneMode) (zoning.cpp:473)
    by 0x82CA3BC: Client::ProcessMovePC(unsigned, unsigned, float, float, float, float, unsigned char, ZoneMode) (zoning.cpp:447)
    by 0x82CA5E4: Client::MovePC(unsigned, float, float, float, float, unsigned char, ZoneMode) (zoning.cpp:404)
    by 0x82CA627: Client::GoToDeath() (zoning.cpp:711)
    by 0x8118406: Client::Death(Mob*, int, unsigned short, SkillType) (attack.cpp:1557)
    by 0x81190CC: Mob::CommonDamage(Mob*, int&, unsigned short, SkillType, bool&, signed char, bool) (attack.cpp:3013)
    by 0x8119D23: Client::Damage(Mob*, int, unsigned short, SkillType, bool, signed char, bool) (attack.cpp:1287)
    by 0x8115D11: NPC::Attack(Mob*, int, bool) (attack.cpp:1745)
    by 0x813F481: Mob::AI_Process() (MobAI.cpp:1179)
    by 0x8104F73: NPC::Process() (npc.cpp:623)
Code:
Index: T:/svn/trunk/EQEmuServer/zone/zoning.cpp
===================================================================
--- T:/svn/trunk/EQEmuServer/zone/zoning.cpp	(revision 966)
+++ T:/svn/trunk/EQEmuServer/zone/zoning.cpp	(working copy)
@@ -476,6 +476,7 @@
 
 	if(!pZoneName) {
 		Message(13, "Invalid zone number specified");
+		safe_delete_array(pZoneName);
 		return;
 	}
 	iZoneNameLength = strlen(pZoneName);
@@ -655,6 +656,8 @@
 			}
 		}
 	}
+
+	safe_delete_array(pZoneName);
 }
 
 void Client::GoToSafeCoords(uint16 zone_id, uint16 instance_id) {
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote