about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--tools/kleaver/main.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/kleaver/main.cpp b/tools/kleaver/main.cpp
index 7c437e47..7525eb7a 100644
--- a/tools/kleaver/main.cpp
+++ b/tools/kleaver/main.cpp
@@ -109,9 +109,16 @@ static bool EvaluateInputAST(const char *Filename,
     llvm::cerr << Filename << ": parse failure: "
                << N << " errors.\n";
     success = false;
-  }
+  }  
   delete P;
 
+  if (!success) {
+    for (std::vector<Decl*>::iterator it = Decls.begin(),
+           ie = Decls.end(); it != ie; ++it)
+      delete *it;
+    return success;
+  }
+
   // FIXME: Support choice of solver.
   Solver *S, *STP = new STPSolver(true);
   S = createCexCachingSolver(STP);
@@ -156,7 +163,7 @@ int main(int argc, char **argv) {
   std::string ErrorStr;
   MemoryBuffer *MB = MemoryBuffer::getFileOrSTDIN(InputFile.c_str(), &ErrorStr);
   if (!MB) {
-    llvm::cerr << argv[0] << ": ERROR: " << ErrorStr << "\n";
+    llvm::cerr << argv[0] << ": error: " << ErrorStr << "\n";
     return 1;
   }
 
@@ -172,7 +179,7 @@ int main(int argc, char **argv) {
                                MB);
     break;
   default:
-    llvm::cerr << argv[0] << ": ERROR: Unknown program action!\n";
+    llvm::cerr << argv[0] << ": error: Unknown program action!\n";
   }
 
   delete MB;