diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 1c2b0b933..be17d9c11 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -191,7 +191,7 @@ public: void cleanup() { - if (bufferLen > 0) + if ((type <= TypeInternalString) && (bufferLen > 0)) { dFree(sval); bufferLen = 0; @@ -201,6 +201,8 @@ public: ival = 0; fval = 0; } + ConsoleValue(){ init(); }; + ~ConsoleValue(){ cleanup(); }; }; // Proxy class for console variables diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index 8284ffb34..ae35035f7 100644 --- a/Engine/source/platform/profiler.cpp +++ b/Engine/source/platform/profiler.cpp @@ -212,11 +212,14 @@ Profiler::~Profiler() void Profiler::reset() { mEnabled = false; // in case we're in a profiler call. - while(mProfileList) + ProfilerData * head = mProfileList; + ProfilerData * curr = NULL; + while ((curr = head) != NULL) { - free(mProfileList); - mProfileList = NULL; + head = head->mNextProfilerData; + free(curr); } + for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot) { walk->mFirstProfilerData = 0;