diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index ca34b4593..c978b9ac2 100644 --- a/Engine/source/platform/profiler.cpp +++ b/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;