<div dir="ltr">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]"</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 3, 2015 at 2:23 PM, Derek Schuff <span dir="ltr"><<a href="mailto:dschuff@google.com" target="_blank">dschuff@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dschuff<br>
Date: Mon Aug 3 16:23:51 2015<br>
New Revision: 243904<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D243904-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=LxW7bsKKShZyS81xQNs0cPpEI1VNo3Uq9k4VT_LYvtU&s=ECdFYXgvanWUN554xrQPIVxIdAk_4DlarjnHtm9gvEw&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=243904&view=rev</a><br>
Log:<br>
Fix memory leak in unit test of Bitcode/BitReaderTest.cpp<br>
<br>
Fixes obvious memory leak in test<br>
TestForEofAfterReadFailureOnDataStreamer. Also removes constexpr use<br>
from same test.<br>
<br>
Patch by Karl Schimpf.<br>
<br>
Differential Revision: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D11735&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=LxW7bsKKShZyS81xQNs0cPpEI1VNo3Uq9k4VT_LYvtU&s=D3a3dfQAiA9v06DaKOfrSjUTMfytn9D-_y-KwDPnRnE&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/D11735</a><br>
<br>
Modified:<br>
llvm/trunk/unittests/Bitcode/BitReaderTest.cpp<br>
<br>
Modified: llvm/trunk/unittests/Bitcode/BitReaderTest.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_unittests_Bitcode_BitReaderTest.cpp-3Frev-3D243904-26r1-3D243903-26r2-3D243904-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=LxW7bsKKShZyS81xQNs0cPpEI1VNo3Uq9k4VT_LYvtU&s=qGSYgEhvBQw3subGpqoh0D8YKWXi284_fb1erUB4cX4&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Bitcode/BitReaderTest.cpp?rev=243904&r1=243903&r2=243904&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/Bitcode/BitReaderTest.cpp (original)<br>
+++ llvm/trunk/unittests/Bitcode/BitReaderTest.cpp Mon Aug 3 16:23:51 2015<br>
@@ -118,10 +118,12 @@ TEST(BitReaderTest, TestForEofAfterReadF<br>
// Jump to two bytes before end of stream.<br>
Cursor.JumpToBit((InputSize - 4) * CHAR_BIT);<br>
// Try to read 4 bytes when only 2 are present, resulting in error value 0.<br>
- constexpr size_t ReadErrorValue = 0;<br>
+ const size_t ReadErrorValue = 0;<br>
EXPECT_EQ(ReadErrorValue, Cursor.Read(32));<br>
// Should be at eof now.<br>
EXPECT_TRUE(Cursor.AtEndOfStream());<br>
+<br>
+ delete[] Text;<br>
}<br>
<br>
TEST(BitReaderTest, MateralizeForwardRefWithStream) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>