Bug 2927

Summary: Valgrind error in lena-x2-handover example
Product: ns-3 Reporter: Manuel Requena <manuel.requena>
Component: lteAssignee: Manuel Requena <manuel.requena>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs
Priority: P3    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Manuel Requena 2018-06-08 06:10:15 UTC
Running the following (in Fedora 26 and Ubuntu 16):

$ ./waf configure --enable-examples --disable-gtk
$ ./waf build
$ ./waf --command-template="valgrind --track-origins=yes %s" --run lena-x2-handover

generates valgrind errors:
==89724== Use of uninitialised value of size 8
==89724==  Uninitialised value was created by a heap allocation
==89724== Conditional jump or move depends on uninitialised value(s)

in radio-bearer-stats-calculator

==89724==    by 0x5662FEC: ns3::RadioBearerStatsCalculator::WriteDlResults(std::basic_ofstream<char, 
std::char_traits<char> >&) (radio-bearer-stats-calculator.cc:354)
==89724==    by 0x5661FC8: 
ns3::RadioBearerStatsCalculator::ShowResults() 
(radio-bearer-stats-calculator.cc:265)
==89724==    by 0x5664018: ns3::RadioBearerStatsCalculator::EndEpoch() 
(radio-bearer-stats-calculator.cc:409)
Comment 1 Manuel Requena 2018-06-08 06:19:22 UTC
A first investigation shows that []operator is used in a map. So, if element is not present, it is created with uninitialized values (so, the valgrind error).

Added some checks in changeset:   13640:709f3122a16a

But now we have a crash. It means something is wrong with the connection of the stats.