mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
Fix memory leak in getIdentity method
Replace static pointer and new() operator with normal static variable
This commit is contained in:
parent
ebc49de851
commit
6d33ad248d
1 changed files with 9 additions and 8 deletions
|
@ -62,17 +62,18 @@ struct Transformation
|
||||||
|
|
||||||
static const Transformation* getIdentity()
|
static const Transformation* getIdentity()
|
||||||
{
|
{
|
||||||
static Transformation* identity = NULL;
|
static Transformation identity;
|
||||||
if (NULL == identity)
|
static bool iset = false;
|
||||||
|
if (!iset)
|
||||||
{
|
{
|
||||||
identity = new Transformation();
|
identity.scale = 1.0f;
|
||||||
identity->scale = 1.0f;
|
identity.rotation.v[0].array[0] = 1.0f;
|
||||||
identity->rotation.v[0].array[0] = 1.0f;
|
identity.rotation.v[1].array[1] = 1.0f;
|
||||||
identity->rotation.v[1].array[1] = 1.0f;
|
identity.rotation.v[2].array[2] = 1.0f;
|
||||||
identity->rotation.v[2].array[2] = 1.0f;
|
iset = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return identity;
|
return &identity;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
Loading…
Reference in a new issue