Explorar o código

Merge pull request #1413 from Azaezel/LittleLeakLost

partial reversion for #1333
Anis %!s(int64=9) %!d(string=hai) anos
pai
achega
8f4295879d
Modificáronse 1 ficheiros con 12 adicións e 4 borrados
  1. 12 4
      Engine/source/platform/profiler.cpp

+ 12 - 4
Engine/source/platform/profiler.cpp

@@ -215,13 +215,21 @@ void Profiler::reset()
 {
    mEnabled = false; // in case we're in a profiler call.
    ProfilerData * head = mProfileList;
-   ProfilerData * curr = NULL;
-   while ((curr = head) != NULL)
+   ProfilerData * curr = head;
+
+   while ( curr )
    {
-      head = head->mNextProfilerData;
-      free(curr);
+      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;