From: Daniel Dunbar Date: Mon, 27 Oct 2008 20:40:41 +0000 (+0000) Subject: Don't double free module when IRgen fails. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d611bac92c6766eb7783619484156e2a86175f50;p=clang Don't double free module when IRgen fails. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58266 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/Backend.cpp b/Driver/Backend.cpp index 98cfeea380..823f666abc 100644 --- a/Driver/Backend.cpp +++ b/Driver/Backend.cpp @@ -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; }