From d611bac92c6766eb7783619484156e2a86175f50 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 27 Oct 2008 20:40:41 +0000 Subject: [PATCH] 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 --- Driver/Backend.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; }