From 129395c89671526f38cd8a3ee1a98fc70fbaf7e9 Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Mon, 27 Aug 2012 00:57:25 -0400 Subject: [PATCH] Fixed minor memory leaks in cstrike ext (bug 5456, r=psychonic). --- extensions/cstrike/natives.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/cstrike/natives.cpp b/extensions/cstrike/natives.cpp index 4834ffac..47c905d1 100644 --- a/extensions/cstrike/natives.cpp +++ b/extensions/cstrike/natives.cpp @@ -206,17 +206,17 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params) } //Psychonic is awesome for this - sm_sendprop_info_t *spi = new sm_sendprop_info_t; + sm_sendprop_info_t spi; IServerUnknown *pUnk = (IServerUnknown *)pWeapon; IServerNetworkable *pNet = pUnk->GetNetworkable(); - if (!UTIL_FindDataTable(pNet->GetServerClass()->m_pTable, "DT_WeaponCSBase", spi, 0)) + if (!UTIL_FindDataTable(pNet->GetServerClass()->m_pTable, "DT_WeaponCSBase", &spi, 0)) return pContext->ThrowNativeError("Entity index %d is not a weapon", params[2]); - if (!gamehelpers->FindSendPropInfo("CBaseCombatWeapon", "m_hOwnerEntity", spi)) + if (!gamehelpers->FindSendPropInfo("CBaseCombatWeapon", "m_hOwnerEntity", &spi)) return pContext->ThrowNativeError("Invalid entity index %d for weapon", params[2]); - CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pWeapon + spi->actual_offset); + CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pWeapon + spi.actual_offset); if (params[1] != hndl.GetEntryIndex()) return pContext->ThrowNativeError("Weapon %d is not owned by client %d", params[2], params[1]); @@ -312,7 +312,7 @@ static cell_t CS_GetTranslatedWeaponAlias(IPluginContext *pContext, const cell_t pContext->LocalToString(params[2], &dest); pContext->LocalToString(params[1], &weapon); - char *ret = new char[128]; + char *ret = NULL; unsigned char vstk[sizeof(char *)]; unsigned char *vptr = vstk;