Fixed minor memory leaks in cstrike ext (bug 5456, r=psychonic).
This commit is contained in:
parent
0a10d6022f
commit
b0075842d1
@ -210,17 +210,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]);
|
||||
|
||||
|
@ -90,7 +90,7 @@ const char *GetTranslatedWeaponAlias(const char *weapon)
|
||||
retpass.size = sizeof(const char *); \
|
||||
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
|
||||
}
|
||||
const char *ret = new char[128];
|
||||
const char *ret = NULL;
|
||||
|
||||
unsigned char vstk[sizeof(const char *)];
|
||||
unsigned char *vptr = vstk;
|
||||
|
Loading…
Reference in New Issue
Block a user