Make *SURE* to null out the pointer before throwing an exception, otherwise
the dtor for the BytecodeReader class will try to free it again!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17856 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index 65d4c1c..6743bc8 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -2240,8 +2240,10 @@
freeState();
delete TheModule;
TheModule = 0;
- if (decompressedBlock != 0 )
+ if (decompressedBlock != 0 ) {
::free(decompressedBlock);
+ decompressedBlock = 0;
+ }
throw;
} catch (...) {
std::string msg("Unknown Exception Occurred");
@@ -2249,8 +2251,10 @@
freeState();
delete TheModule;
TheModule = 0;
- if (decompressedBlock != 0 )
+ if (decompressedBlock != 0) {
::free(decompressedBlock);
+ decompressedBlock = 0;
+ }
throw msg;
}
}