From 736a761bffbca4dde9016efd3d4abbce5e733210 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 1 Sep 2017 19:43:05 -0700 Subject: [PATCH] Fix a couple of twtest-only valgrind issues --- src/twtest/crytpo_t.cpp | 10 +++++++--- src/twtest/fcosetimpl_t.cpp | 11 +++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/twtest/crytpo_t.cpp b/src/twtest/crytpo_t.cpp index 5d83447..d3a0be2 100644 --- a/src/twtest/crytpo_t.cpp +++ b/src/twtest/crytpo_t.cpp @@ -44,9 +44,13 @@ void TestCrypto() const int BUFSIZE = 9000; - char source[BUFSIZE]; - char crypt[COUNT + BUFSIZE]; // needs to be able to hold even number of blocks - char dest[COUNT]; + std::vector source_buf(BUFSIZE); + std::vector crypt_buf(COUNT + BUFSIZE); // needs to be able to hold even number of blocks + std::vector dest_buf(COUNT); + + char* source = &source_buf[0]; + char* crypt = &crypt_buf[0]; + char* dest = &dest_buf[0]; memcpy(source, "I love the smell of the sheep.", 31); diff --git a/src/twtest/fcosetimpl_t.cpp b/src/twtest/fcosetimpl_t.cpp index 1cfc034..153e0d0 100644 --- a/src/twtest/fcosetimpl_t.cpp +++ b/src/twtest/fcosetimpl_t.cpp @@ -75,10 +75,12 @@ void TestFCOSetImpl() pFCO3->Release(); // let's iterate over the fcos - cIterProxy pit(set.GetIter()); + iFCOIter* pIter = set.GetIter(); + cIterProxy pit(pIter); pit->SeekBegin(); PrintIter(pit, d); + // lookup a specific fco cIterProxy pit2(set.Lookup(cFCOName(_T("fco2")))); if(! (iFCOIter*)pit2) @@ -113,10 +115,14 @@ void TestFCOSetImpl() // test operator= cFCOSetImpl set2; set2 = set; - pit = set2.GetIter(); + + pIter->DestroyIter(); + pIter = set2.GetIter(); + pit = pIter; d.TraceDebug("Made a new set and set it equal to the first with operator=; printing out...\n"); PrintIter(pit, d); + // test IsEmpty set.Clear(); TEST(set.IsEmpty()); @@ -142,6 +148,7 @@ void TestFCOSetImpl() pit = set3.GetIter(); PrintIter(pit, d); + pIter->DestroyIter(); d.TraceDebug("Leaving...\n"); return;