[llvm] r243904 - Fix memory leak in unit test of Bitcode/BitReaderTest.cpp
David Blaikie
dblaikie at gmail.com
Mon Aug 3 14:33:18 PDT 2015
You could use std::unique_ptr<char[]> or possibly easier to just use a
std::vector<char> (or std::string). You could probably even use plain "char
Text[StreamingMemoryObject::kChunkSize + 5]"
On Mon, Aug 3, 2015 at 2:23 PM, Derek Schuff <dschuff at google.com> wrote:
> Author: dschuff
> Date: Mon Aug 3 16:23:51 2015
> New Revision: 243904
>
> URL: http://llvm.org/viewvc/llvm-project?rev=243904&view=rev
> Log:
> Fix memory leak in unit test of Bitcode/BitReaderTest.cpp
>
> Fixes obvious memory leak in test
> TestForEofAfterReadFailureOnDataStreamer. Also removes constexpr use
> from same test.
>
> Patch by Karl Schimpf.
>
> Differential Revision: http://reviews.llvm.org/D11735
>
> Modified:
> llvm/trunk/unittests/Bitcode/BitReaderTest.cpp
>
> Modified: llvm/trunk/unittests/Bitcode/BitReaderTest.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Bitcode/BitReaderTest.cpp?rev=243904&r1=243903&r2=243904&view=diff
>
> ==============================================================================
> --- llvm/trunk/unittests/Bitcode/BitReaderTest.cpp (original)
> +++ llvm/trunk/unittests/Bitcode/BitReaderTest.cpp Mon Aug 3 16:23:51 2015
> @@ -118,10 +118,12 @@ TEST(BitReaderTest, TestForEofAfterReadF
> // Jump to two bytes before end of stream.
> Cursor.JumpToBit((InputSize - 4) * CHAR_BIT);
> // Try to read 4 bytes when only 2 are present, resulting in error
> value 0.
> - constexpr size_t ReadErrorValue = 0;
> + const size_t ReadErrorValue = 0;
> EXPECT_EQ(ReadErrorValue, Cursor.Read(32));
> // Should be at eof now.
> EXPECT_TRUE(Cursor.AtEndOfStream());
> +
> + delete[] Text;
> }
>
> TEST(BitReaderTest, MateralizeForwardRefWithStream) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150803/623ea262/attachment.html>
More information about the llvm-commits
mailing list