plug a little memleak in verifyFunction()
authorNuno Lopes <nunoplopes@sapo.pt>
Tue, 2 Sep 2008 11:30:10 +0000 (11:30 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Tue, 2 Sep 2008 11:30:10 +0000 (11:30 +0000)
# first commit to llvm, so whatch out :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55631 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index 034a0628fbaeeba1fd182070cedf77a466fd86e1..5ca8e1a23a2d1da9a8c1b409d82bc0b336ea9af3 100644 (file)
@@ -1512,10 +1512,12 @@ bool llvm::verifyFunction(const Function &f, VerifierFailureAction action) {
   Function &F = const_cast<Function&>(f);
   assert(!F.isDeclaration() && "Cannot verify external functions");
 
-  FunctionPassManager FPM(new ExistingModuleProvider(F.getParent()));
+  ExistingModuleProvider MP(F.getParent());
+  FunctionPassManager FPM(&MP);
   Verifier *V = new Verifier(action);
   FPM.add(V);
   FPM.run(F);
+  MP.releaseModule();
   return V->Broken;
 }