[llvm] r243904 - Fix memory leak in unit test of Bitcode/BitReaderTest.cpp

Derek Schuff dschuff at google.com
Mon Aug 3 14:23:51 PDT 2015


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) {





More information about the llvm-commits mailing list