From a2602f3dfd0561bf5825e301c173628c35525db8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 22 May 2003 18:26:48 +0000 Subject: [PATCH] Do not assert fail or crash when a bytecode parse fails! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6284 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bytecode/Reader/Reader.cpp | 1 + lib/Bytecode/Reader/ReaderInternals.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 7c0e6d43897..1a7e3d5e56b 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -642,6 +642,7 @@ Module *BytecodeParser::ParseBytecode(const unsigned char *Buf, TheModule = new Module(ModuleID); if (ParseModule(Buf, EndBuf)) { + freeState(); // Must destroy handles before deleting module! delete TheModule; TheModule = 0; } diff --git a/lib/Bytecode/Reader/ReaderInternals.h b/lib/Bytecode/Reader/ReaderInternals.h index 6709bc2d4d6..a8ee6fc8b94 100644 --- a/lib/Bytecode/Reader/ReaderInternals.h +++ b/lib/Bytecode/Reader/ReaderInternals.h @@ -45,6 +45,9 @@ public: FirstDerivedTyID = Type::FirstDerivedTyID; } ~BytecodeParser() { + freeState(); + } + void freeState() { freeTable(Values); freeTable(LateResolveValues); freeTable(ModuleValues); -- 2.34.1