Skip to content

Commit

Permalink
Fix small memory leak for engineRequestModel (PR #2431)
Browse files Browse the repository at this point in the history
Co-authored-by: Vladislav Nikolaevich <v.nikolaevich@redbrixwall.com>
  • Loading branch information
TheNormalnij and Vladislav Nikolaevich committed Nov 7, 2021
1 parent fe48d09 commit b2a625b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Client/game_sa/CModelInfoSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,22 @@ void CModelInfoSA::MakeVehicleAutomobile(ushort usBaseID)
void CModelInfoSA::DeallocateModel(void)
{
Remove();

switch (GetModelType())
{
case eModelInfoType::VEHICLE:
delete reinterpret_cast<CVehicleModelInfoSAInterface*>(ppModelInfo[m_dwModelID]);
break;
case eModelInfoType::PED:
delete reinterpret_cast<CPedModelInfoSAInterface*>(ppModelInfo[m_dwModelID]);
break;
case eModelInfoType::ATOMIC:
delete reinterpret_cast<CBaseModelInfoSAInterface*>(ppModelInfo[m_dwModelID]);
break;
default:
break;
}

ppModelInfo[m_dwModelID] = nullptr;
pGame->GetStreaming()->GetStreamingInfoFromModelId(m_dwModelID)->Reset();
}
Expand Down

0 comments on commit b2a625b

Please sign in to comment.