Bugzilla – Bug 2927
Valgrind error in lena-x2-handover example
Last modified: 2019-05-31 10:02:54 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)
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.
The stats are fixed in https://gitlab.com/nsnam/ns-3-dev/commit/ed411fa9c033bcbcf8b2a44e75c01982848f0df1 Commit https://gitlab.com/nsnam/ns-3-dev/commit/ed411fa9c033bcbcf8b2a44e75c01982848f0df1 removes temp workaround