mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
fixed memory leak in proper way
This commit is contained in:
parent
27112c468a
commit
7418fbfbbd
|
|
@ -214,12 +214,22 @@ Profiler::~Profiler()
|
|||
void Profiler::reset()
|
||||
{
|
||||
mEnabled = false; // in case we're in a profiler call.
|
||||
while (mProfileList)
|
||||
ProfilerData * head = mProfileList;
|
||||
ProfilerData * curr = head;
|
||||
|
||||
while ( curr )
|
||||
{
|
||||
free(mProfileList);
|
||||
mProfileList = NULL;
|
||||
head = curr->mNextProfilerData;
|
||||
free( curr );
|
||||
|
||||
if ( head )
|
||||
curr = head;
|
||||
else
|
||||
curr = NULL;
|
||||
}
|
||||
|
||||
mProfileList = NULL;
|
||||
|
||||
for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot)
|
||||
{
|
||||
walk->mFirstProfilerData = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue