summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-11-15 21:55:33 +0000
committerChris Lattner <sabre@nondot.org>2004-11-15 21:55:33 +0000
commit7d04cdab7760a8e40bc851ad32380389a4d2611a (patch)
tree000aa911b121fe2b06fd463486331a73357fe52a /llvm/lib/Bytecode/Reader
parent36c95e38b0f642ecd95b0026a0b6918f6b48b695 (diff)
downloadbcm5719-llvm-7d04cdab7760a8e40bc851ad32380389a4d2611a.tar.gz
bcm5719-llvm-7d04cdab7760a8e40bc851ad32380389a4d2611a.zip
Make *SURE* to null out the pointer before throwing an exception, otherwise
the dtor for the BytecodeReader class will try to free it again! llvm-svn: 17856
Diffstat (limited to 'llvm/lib/Bytecode/Reader')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index 65d4c1c15d7..6743bc8da0b 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/lib/Bytecode/Reader/Reader.cpp
@@ -2240,8 +2240,10 @@ void BytecodeReader::ParseBytecode(BufPtr Buf, unsigned Length,
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 @@ void BytecodeReader::ParseBytecode(BufPtr Buf, unsigned Length,
freeState();
delete TheModule;
TheModule = 0;
- if (decompressedBlock != 0 )
+ if (decompressedBlock != 0) {
::free(decompressedBlock);
+ decompressedBlock = 0;
+ }
throw msg;
}
}
OpenPOWER on IntegriCloud