removed extra handle deletion

This commit is contained in:
not-log 2021-06-04 17:49:06 +03:00
parent f2fcfa50e1
commit fbc5084f55

View File

@ -148,7 +148,6 @@ void HookSoundScapes()
Handle hGameData = LoadGameConfigFile("SoundManager.games"); Handle hGameData = LoadGameConfigFile("SoundManager.games");
if(!hGameData) if(!hGameData)
{ {
delete hGameData;
SetFailState("Failed to load SoundManager gamedata."); SetFailState("Failed to load SoundManager gamedata.");
} }
@ -156,12 +155,12 @@ void HookSoundScapes()
DHookSetFromConf(hFunction, hGameData, SDKConf_Signature, "CEnvSoundscape::UpdateForPlayer"); DHookSetFromConf(hFunction, hGameData, SDKConf_Signature, "CEnvSoundscape::UpdateForPlayer");
DHookAddParam(hFunction, HookParamType_ObjectPtr); DHookAddParam(hFunction, HookParamType_ObjectPtr);
delete hGameData;
if(!DHookEnableDetour(hFunction, false, DHook_UpdateForPlayer)) if(!DHookEnableDetour(hFunction, false, DHook_UpdateForPlayer))
{ {
SetFailState("Couldn't enable CEnvSoundscape::UpdateForPlayer detour."); SetFailState("Couldn't enable CEnvSoundscape::UpdateForPlayer detour.");
} }
delete hGameData;
} }
//void CEnvSoundscape::UpdateForPlayer( ss_update_t &update ) //void CEnvSoundscape::UpdateForPlayer( ss_update_t &update )
@ -203,14 +202,11 @@ void HookAcceptInput()
Handle hGameData = LoadGameConfigFile("SoundManager.games"); Handle hGameData = LoadGameConfigFile("SoundManager.games");
if(!hGameData) if(!hGameData)
{ {
delete hGameData;
SetFailState("Failed to load SoundManager gamedata."); SetFailState("Failed to load SoundManager gamedata.");
} }
int offset = GameConfGetOffset(hGameData, "AcceptInput"); int offset = GameConfGetOffset(hGameData, "AcceptInput");
delete hGameData;
if(offset == 0) if(offset == 0)
{ {
SetFailState("Failed to load \"AcceptInput\", invalid offset."); SetFailState("Failed to load \"AcceptInput\", invalid offset.");
@ -222,6 +218,8 @@ void HookAcceptInput()
DHookAddParam(gH_AcceptInput, HookParamType_CBaseEntity); DHookAddParam(gH_AcceptInput, HookParamType_CBaseEntity);
DHookAddParam(gH_AcceptInput, HookParamType_Object, 20, DHookPass_ByVal|DHookPass_ODTOR|DHookPass_OCTOR|DHookPass_OASSIGNOP); DHookAddParam(gH_AcceptInput, HookParamType_Object, 20, DHookPass_ByVal|DHookPass_ODTOR|DHookPass_OCTOR|DHookPass_OASSIGNOP);
DHookAddParam(gH_AcceptInput, HookParamType_Int); DHookAddParam(gH_AcceptInput, HookParamType_Int);
delete hGameData;
} }
// virtual bool AcceptInput( const char *szInputName, CBaseEntity *pActivator, CBaseEntity *pCaller, variant_t Value, int outputID ); // virtual bool AcceptInput( const char *szInputName, CBaseEntity *pActivator, CBaseEntity *pCaller, variant_t Value, int outputID );
@ -268,7 +266,6 @@ void HookSendSound()
Handle hGameData = LoadGameConfigFile("SoundManager.games"); Handle hGameData = LoadGameConfigFile("SoundManager.games");
if(!hGameData) if(!hGameData)
{ {
delete hGameData;
SetFailState("Failed to load SoundManager gamedata."); SetFailState("Failed to load SoundManager gamedata.");
} }
@ -281,8 +278,6 @@ void HookSendSound()
PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, "CBaseClient::GetPlayerSlot"); PrepSDKCall_SetFromConf(hGameData, SDKConf_Virtual, "CBaseClient::GetPlayerSlot");
PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain); PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain);
delete hGameData;
if (!(gH_GetPlayerSlot = EndPrepSDKCall())) if (!(gH_GetPlayerSlot = EndPrepSDKCall()))
{ {
SetFailState("Could not initialize call to CBaseClient::GetPlayerSlot."); SetFailState("Could not initialize call to CBaseClient::GetPlayerSlot.");
@ -292,6 +287,8 @@ void HookSendSound()
{ {
SetFailState("Couldn't enable CGameClient::SendSound detour."); SetFailState("Couldn't enable CGameClient::SendSound detour.");
} }
delete hGameData;
} }
//void CGameClient::SendSound( SoundInfo_t &sound, bool isReliable ) //void CGameClient::SendSound( SoundInfo_t &sound, bool isReliable )