]> granicus.if.org Git - clang/commitdiff
Don't double free module when IRgen fails.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 27 Oct 2008 20:40:41 +0000 (20:40 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 27 Oct 2008 20:40:41 +0000 (20:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58266 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/Backend.cpp

index 98cfeea380bce4dd1b2c92b3b03917ecb106cd8d..823f666abc6263f509d0c4a82b5b517e4be90550 100644 (file)
@@ -315,10 +315,13 @@ void BackendConsumer::EmitAssembly() {
   if (!TheModule || !TheTargetData)
     return;
 
-  // Make sure IR generation is happy with the module.
-  // FIXME: Release this.
+  // Make sure IR generation is happy with the module. This is
+  // released by the module provider.
   Module *M = Gen->ReleaseModule();
   if (!M) {
+    // The module has been released by IR gen on failures, do not
+    // double free.
+    ModuleProvider->releaseModule();
     TheModule = 0;
     return;
   }