Skip to content

Commit d4b20dd

Browse files
committed
[FIX] Memory of dummy sequences' frames was not being freed for IFP Version 2. Now, it's being freed
1 parent 9af78ea commit d4b20dd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Client/mods/deathmatch/logic/CClientIFP.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void CClientIFP::UnloadIFP ( void )
4949
{
5050
for (unsigned short SequenceIndex = 0; SequenceIndex < ifpAnimation->Hierarchy.m_nSeqCount; SequenceIndex++)
5151
{
52-
5352
_CAnimBlendSequence * pSequence = (_CAnimBlendSequence*)((BYTE*)ifpAnimation->Hierarchy.m_pSequences + (sizeof(_CAnimBlendSequence) * SequenceIndex));
5453
free ( pSequence->m_pFrames );
5554
}
@@ -62,6 +61,12 @@ void CClientIFP::UnloadIFP ( void )
6261
delete ifpAnimation->pSequencesMemory;
6362
}
6463

64+
for (size_t DummySequenceIndex = 0; DummySequenceIndex < m_DummySequencesKeyFrames.size(); DummySequenceIndex++)
65+
{
66+
unsigned char * pKeyFrames = m_DummySequencesKeyFrames [ DummySequenceIndex ];
67+
free ( pKeyFrames );
68+
}
69+
6570
printf ("IFP unloaded sucessfully\n");
6671
}
6772

@@ -687,6 +692,11 @@ void CClientIFP::insertAnimDummySequence ( bool anp3, _CAnimBlendHierarchy * pAn
687692

688693
pKeyFrames = (unsigned char*)malloc(FramesDataSizeInBytes);
689694

695+
if ( !isVersion1 )
696+
{
697+
m_DummySequencesKeyFrames.push_back ( pKeyFrames );
698+
}
699+
690700
OLD__CAnimBlendSequence_SetNumFrames(pSequence, TotalFrames, bIsRoot, bIsCompressed, pKeyFrames);
691701

692702
switch (BoneID)

Client/mods/deathmatch/logic/CClientIFP.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class CClientIFP: public CClientEntity, FileLoader
4848
private:
4949
SString m_strBlockName;
5050
std::vector < IFP_Animation > m_Animations;
51+
std::vector < unsigned char * > m_DummySequencesKeyFrames;
5152
bool isVersion1;
5253
IFPHeaderV2 HeaderV2;
5354

0 commit comments

Comments
 (0)