Browse Source

small memory leak with multiple #defines...

Roger Hughston 19 years ago
parent
commit
859fc08886
2 changed files with 13 additions and 1 deletions
  1. 12 0
      dtool/src/cppparser/cppPreprocessor.cxx
  2. 1 1
      dtool/src/cppparser/cppType.cxx

+ 12 - 0
dtool/src/cppparser/cppPreprocessor.cxx

@@ -1231,7 +1231,19 @@ handle_define_directive(const string &args, int first_line,
         manifest->_expr = parse_expr(expr_string, global_scope, global_scope);
       }
     }
+
+    // ok one memory leak here..
+    Manifests::iterator mi = _manifests.find(manifest->_name);
+    if(mi != _manifests.end())
+    {
+        // i do not see a goodway to compare the old and new hmmmm
+        //cerr << "Warning Overwriting Constant " << manifest->_name << "\n";
+        delete mi->second;
+    }
+
     _manifests[manifest->_name] = manifest;
+
+
   }
 }
 

+ 1 - 1
dtool/src/cppparser/cppType.cxx

@@ -265,7 +265,7 @@ new_type(CPPType *type) {
     // however, it's not.  Thus, someone failed to call new_type() on
     // a type pointer before saving it somewhere.  Fix me soon.  ****
 
-    //delete type;
+    delete type;
   }
   return *result.first;
 }