mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-07 11:13:47 +03:00
Make sure to delete all conditional objects
This fixes the issue where memory would be leaked by conditionals
This commit is contained in:
parent
b1c5d6c62a
commit
032fb9b5ba
1 changed files with 15 additions and 0 deletions
|
@ -4973,10 +4973,25 @@ void Player::InitTorsoStateTable(void)
|
||||||
|
|
||||||
void Player::LoadStateTable(void)
|
void Player::LoadStateTable(void)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
Conditional* cond;
|
||||||
|
|
||||||
statemap_Legs = NULL;
|
statemap_Legs = NULL;
|
||||||
statemap_Torso = NULL;
|
statemap_Torso = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Free existing conditionals
|
||||||
|
//
|
||||||
|
for (i = legs_conditionals.NumObjects(); i > 0; i--) {
|
||||||
|
cond = legs_conditionals.ObjectAt(i);
|
||||||
|
delete cond;
|
||||||
|
}
|
||||||
legs_conditionals.FreeObjectList();
|
legs_conditionals.FreeObjectList();
|
||||||
|
|
||||||
|
for (i = torso_conditionals.NumObjects(); i > 0; i--) {
|
||||||
|
cond = torso_conditionals.ObjectAt(i);
|
||||||
|
delete cond;
|
||||||
|
}
|
||||||
torso_conditionals.FreeObjectList();
|
torso_conditionals.FreeObjectList();
|
||||||
|
|
||||||
statemap_Legs =
|
statemap_Legs =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue