From f32a277643fb4c92429a09e19df8422029b8d57e Mon Sep 17 00:00:00 2001 From: Derision Date: Tue, 19 Mar 2013 19:22:16 +0000 Subject: [PATCH 1/3] Fixed memory leak in OP_VeteranRewardsAvailable --- common/patches/RoF.cpp | 3 ++- common/patches/SoD.cpp | 3 ++- common/patches/SoF.cpp | 3 ++- common/patches/Titanium.cpp | 3 ++- common/patches/Underfoot.cpp | 3 ++- zone/zonedb.cpp | 1 - 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/common/patches/RoF.cpp b/common/patches/RoF.cpp index 1c56e27cd..b44cb8f37 100644 --- a/common/patches/RoF.cpp +++ b/common/patches/RoF.cpp @@ -3150,6 +3150,7 @@ ENCODE(OP_VetRewardsAvaliable) unsigned char * __emu_buffer = inapp->pBuffer; uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); + *p = NULL; EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); uchar *old_data = __emu_buffer; @@ -3174,7 +3175,7 @@ ENCODE(OP_VetRewardsAvaliable) } dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + delete inapp; } ENCODE(OP_WhoAllResponse) diff --git a/common/patches/SoD.cpp b/common/patches/SoD.cpp index 99e6cd8c0..9e272a14c 100644 --- a/common/patches/SoD.cpp +++ b/common/patches/SoD.cpp @@ -2097,6 +2097,7 @@ ENCODE(OP_VetRewardsAvaliable) unsigned char * __emu_buffer = inapp->pBuffer; uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); + *p = NULL; EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); uchar *old_data = __emu_buffer; @@ -2121,7 +2122,7 @@ ENCODE(OP_VetRewardsAvaliable) } dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + delete inapp; } ENCODE(OP_WhoAllResponse) diff --git a/common/patches/SoF.cpp b/common/patches/SoF.cpp index b2794d9af..873f3f19d 100644 --- a/common/patches/SoF.cpp +++ b/common/patches/SoF.cpp @@ -1735,6 +1735,7 @@ ENCODE(OP_VetRewardsAvaliable) unsigned char * __emu_buffer = inapp->pBuffer; uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); + *p = NULL; EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); uchar *old_data = __emu_buffer; @@ -1759,7 +1760,7 @@ ENCODE(OP_VetRewardsAvaliable) } dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + delete inapp; } ENCODE(OP_DeleteSpawn) { diff --git a/common/patches/Titanium.cpp b/common/patches/Titanium.cpp index 469ba9b57..8f4624bed 100644 --- a/common/patches/Titanium.cpp +++ b/common/patches/Titanium.cpp @@ -898,6 +898,7 @@ ENCODE(OP_VetRewardsAvaliable) unsigned char * __emu_buffer = inapp->pBuffer; uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); + *p = NULL; EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); uchar *old_data = __emu_buffer; @@ -916,7 +917,7 @@ ENCODE(OP_VetRewardsAvaliable) } dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + delete inapp; } ENCODE(OP_InspectAnswer) { diff --git a/common/patches/Underfoot.cpp b/common/patches/Underfoot.cpp index 0da4f60c9..d56a21d3b 100644 --- a/common/patches/Underfoot.cpp +++ b/common/patches/Underfoot.cpp @@ -2157,6 +2157,7 @@ ENCODE(OP_VetRewardsAvaliable) unsigned char * __emu_buffer = inapp->pBuffer; uint32 count = ((*p)->Size() / sizeof(InternalVeteranReward)); + *p = NULL; EQApplicationPacket *outapp_create = new EQApplicationPacket(OP_VetRewardsAvaliable, (sizeof(structs::VeteranReward)*count)); uchar *old_data = __emu_buffer; @@ -2181,7 +2182,7 @@ ENCODE(OP_VetRewardsAvaliable) } dest->FastQueuePacket(&outapp_create); - delete[] __emu_buffer; + delete inapp; } ENCODE(OP_WhoAllResponse) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 46604282f..6e2953534 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1885,7 +1885,6 @@ void ZoneDatabase::LoadMercBuffs(Merc *merc) { } safe_delete_array(Query); - Query = 0; if(errorMessage.empty() && BuffsLoaded) { if(!database.RunQuery(Query, MakeAnyLenString(&Query, "DELETE FROM merc_buffs WHERE MercId = %u", merc->GetMercID()), TempErrorMessageBuffer)) { From 6ae8fbc0e4915309aa839184b4f8e20f98ee5a9c Mon Sep 17 00:00:00 2001 From: Derision Date: Tue, 19 Mar 2013 20:44:22 +0000 Subject: [PATCH 2/3] Initialised some data in Mob/Merc constructors to stop valgrind complaining. --- zone/merc.cpp | 4 +++- zone/mob.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 37155085f..c385f0d1f 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -37,9 +37,11 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading) _baseFR = d->FR; _basePR = d->PR; _baseCorrup = d->Corrup; + _OwnerClientVersion = EQClientTitanium; RestRegenHP = 0; RestRegenMana = 0; RestRegenEndurance = 0; + cur_end = 0; _medding = false; _suspended = false; @@ -2749,7 +2751,7 @@ int16 Merc::GetFocusEffect(focusType type, uint16 spell_id) { int16 focus_max_real = 0; //item focus - for(int x=0; x<=MAX_WORN_INVENTORY; x++) + for(int x =0; x < MAX_WORN_INVENTORY; ++x) { TempItem = NULL; if (equipment[x] == 0) diff --git a/zone/mob.cpp b/zone/mob.cpp index 8bd2d362c..6c8bbc398 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -274,7 +274,7 @@ Mob::Mob(const char* in_name, memset(&itembonuses, 0, sizeof(StatBonuses)); memset(&spellbonuses, 0, sizeof(StatBonuses)); - //memset(&aabonuses, 0, sizeof(StatBonuses)); //don't need this until we start using Client::CalcAABonuses() + memset(&aabonuses, 0, sizeof(StatBonuses)); spellbonuses.AggroRange = -1; spellbonuses.AssistRange = -1; pLastChange = 0; From 886c7bf634fe2643e883fefd7bb83fa26fde682f Mon Sep 17 00:00:00 2001 From: mackal Date: Wed, 20 Mar 2013 23:29:00 -0400 Subject: [PATCH 3/3] Fixed stacking issues with SE_Limit* (ex. Unholy Aura Discipline and Aura of Reverence) --- changelog.txt | 3 +++ zone/spells.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/changelog.txt b/changelog.txt index 372c908c7..81d29c717 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 03/20/2013 == +demonstar55: Fixed stacking issues with SE_Limit* (ex. Unholy Aura Discipline and Aura of Reverence) + == 03/18/2013 == Bad_Captain: Fixed zone crash due to merc focus effects & tribute. Bad_Captain: Fixed merc aggro issues when client in melee range & spell recast timers. diff --git a/zone/spells.cpp b/zone/spells.cpp index 6d624bfae..5c85b4445 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2564,6 +2564,22 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, if(effect1 != effect2) continue; + /* + Skip check if effect is SE_Limit* + skip checking effect2 since we know they are equal + */ + if(effect1 == SE_LimitMaxLevel || + effect1 == SE_LimitResist || + effect1 == SE_LimitTarget || + effect1 == SE_LimitEffect || + effect1 == SE_LimitSpellType || + effect1 == SE_LimitSpell || + effect1 == SE_LimitMinDur || + effect1 == SE_LimitInstant || + effect1 == SE_LimitMinLevel || + effect1 == SE_LimitCastTime) + continue; + /* If target is a npc and caster1 and caster2 exist If Caster1 isn't the same as Caster2 and the effect is a DoT then ignore it.