[PATCH] D11735: Fix memory leak in unit test of Bitcode/BitReaderTest.cpp

Karl Schimpf kschimpf at google.com
Mon Aug 3 14:05:21 PDT 2015


kschimpf created this revision.
kschimpf added reviewers: jvoung, rafael, filcab, dschuff.
kschimpf added a subscriber: llvm-commits.

Fixes obvious memory leak in test
TestForEofAfterReadFailureOnDataStreamer.  Also removes constexpr use
from same test.

http://reviews.llvm.org/D11735

Files:
  unittests/Bitcode/BitReaderTest.cpp

Index: unittests/Bitcode/BitReaderTest.cpp
===================================================================
--- unittests/Bitcode/BitReaderTest.cpp
+++ unittests/Bitcode/BitReaderTest.cpp
@@ -118,10 +118,12 @@
   // 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11735.31264.patch
Type: text/x-patch
Size: 658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150803/07cdf001/attachment.bin>


More information about the llvm-commits mailing list