Browse Source

leak prevention according to: https://vld.codeplex.com/ ConsoleValue() constructors and destructors to handle corner-cases not already addressed via init, and cleanup

Azaezel 10 years ago
parent
commit
b1e8a45a48
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Engine/source/console/console.h

+ 3 - 1
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