diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-24 17:20:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-24 17:20:52 +0000 |
commit | 4ab2d2009e4a16d1a5104047e1e2cdbbf2cb9b1a (patch) | |
tree | ded3c3ddeb21c902a4cf269a228dc757b91a74ed /lib/Bytecode/Reader/Reader.cpp | |
parent | 253bb78adb5121988f98fc57e944248eae8cf2ea (diff) |
fix a memory leak
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/Reader.cpp')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 98ed57ea6f..ee6d9e6208 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -1299,11 +1299,12 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) { Result = ConstantInt::get(IT, Val); if (Handler) Handler->handleConstantValue(Result); } else { - uint32_t numWords = read_vbr_uint(); - uint64_t *data = new uint64_t[numWords]; - for (uint32_t i = 0; i < numWords; ++i) - data[i] = read_vbr_uint64(); - Result = ConstantInt::get(APInt(IT->getBitWidth(), numWords, data)); + uint32_t NumWords = read_vbr_uint(); + SmallVector<uint64_t, 8> Words; + Words.resize(NumWords); + for (uint32_t i = 0; i < NumWords; ++i) + Words[i] = read_vbr_uint64(); + Result = ConstantInt::get(APInt(IT->getBitWidth(), NumWords, &Words[0])); if (Handler) Handler->handleConstantValue(Result); } break; |