Bug 1290 - buffer-test.cc gets a valgrind error
buffer-test.cc gets a valgrind error
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: network
pre-release
All All
: P5 normal
Assigned To: Frederic Urbani
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-09 17:33 UTC by Mitch Watrous
Modified: 2011-11-10 04:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mitch Watrous 2011-11-09 17:33:51 UTC
Some of the ns-3 buildbots (full-rahan-g++-4.0.4) are failing.

I think the cause is the changes to this test:

    src/network/test/buffer-test.cc    

introduced in this changeset:

    Bug 1001 - Buffer::CopyData() doesn't return the number of bytes copied
    author        frederic.urbani@inria.fr
                  Wed Nov 09 10:13:41 2011 +0100 (12 hours ago)
    changeset 7573     a58e7a0cd725
    parent 7572        45789a380d6a
    child 7574         6b792c9b85cc

Here are the valgrind errors that buffer-test now gets: 

    stderr =  ==2499== Memcheck, a memory error detector
    ==2499== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
    ==2499== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright info
    ==2499== Command: /home/buildslave/slave/full-rahan-g++-4.0.4/build/build/utils/test-runner --test-name=buffer --stop-on-failure --xml --tempdir=testpy-output/2011-11-09-18-43-51-CUT --out=testpy-output/2011-11-09-18-43-51-CUT/buffer.xml
    ==2499== 
    ==2499== 
    ==2499== HEAP SUMMARY:
    ==2499==     in use at exit: 39 bytes in 1 blocks
    ==2499==   total heap usage: 11,305 allocs, 11,304 frees, 883,071 bytes allocated
    ==2499== 
    ==2499== 39 bytes in 1 blocks are definitely lost in loss record 1 of 1
    ==2499==    at 0x4A061AB: malloc (vg_replace_malloc.c:236)
    ==2499==    by 0xCEED346: ns3::BufferTest::DoRun() (buffer-test.cc:312)
    ==2499==    by 0xDDE574C: ns3::TestCase::Run(ns3::TestRunnerImpl*) (test.cc:207)
    ==2499==    by 0xDDE5700: ns3::TestCase::Run(ns3::TestRunnerImpl*) (test.cc:201)
    ==2499==    by 0xDDE739E: ns3::TestRunnerImpl::Run(int, char**) (test.cc:785)
    ==2499==    by 0xDDE7596: ns3::TestRunner::Run(int, char**) (test.cc:808)
    ==2499==    by 0x400D12: main (test-runner.cc:23)
    ==2499== 
    ==2499== LEAK SUMMARY:
    ==2499==    definitely lost: 39 bytes in 1 blocks
    ==2499==    indirectly lost: 0 bytes in 0 blocks
    ==2499==      possibly lost: 0 bytes in 0 blocks
    ==2499==    still reachable: 0 bytes in 0 blocks
    ==2499==         suppressed: 0 bytes in 0 blocks
    ==2499== 
    ==2499== For counts of detected and suppressed errors, rerun with: -v
    ==2499== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 7 from 7)
    
    returncode = 2
Comment 1 Frederic Urbani 2011-11-10 04:23:40 UTC
Committed patch:

--- a/src/network/test/buffer-test.cc	Sun Nov 06 05:22:00 2011 -0800
+++ b/src/network/test/buffer-test.cc	Thu Nov 10 10:22:19 2011 +0100
@@ -317,7 +317,7 @@
       NS_TEST_ASSERT_MSG_EQ ( cBuf [i], *(((const uint8_t*)ct.c_str ()) + i), "Bad buffer copied data");
       NS_TEST_ASSERT_MSG_EQ ( evilBuffer [i], cBuf [i] , "Bad buffer peeked");
     }
-
+  free (cBuf);
 }
 //-----------------------------------------------------------------------------
 class BufferTestSuite : public TestSuite