Bug 793: remove remaining memory leaks due to not cleaned Simulator
authorFaker Moatamri <faker.moatamri@sophia.inria.fr>
Tue, 19 Jan 2010 17:06:18 +0100
changeset 5919 b89ce2e9eed5
parent 5918 a0e24e8844da
child 5920 17bf6ee332ba
child 6012 4756711e6676
Bug 793: remove remaining memory leaks due to not cleaned Simulator
src/contrib/event-garbage-collector.cc
src/devices/wifi/wifi-test.cc
src/helper/ipv4-address-helper.cc
src/internet-stack/ipv4-test.cc
src/internet-stack/ipv6-test.cc
src/node/ipv4-address-generator.cc
src/routing/aodv/aodv-test-suite.cc
--- a/src/contrib/event-garbage-collector.cc	Tue Jan 19 17:02:38 2010 +0100
+++ b/src/contrib/event-garbage-collector.cc	Tue Jan 19 17:06:18 2010 +0100
@@ -138,7 +138,7 @@
   Simulator::Run ();
   NS_TEST_EXPECT_MSG_EQ (m_events, 0, "");
   NS_TEST_EXPECT_MSG_EQ (m_counter, 50, "");
-
+  Simulator::Destroy ();
   return false;
 }
 
--- a/src/devices/wifi/wifi-test.cc	Tue Jan 19 17:02:38 2010 +0100
+++ b/src/devices/wifi/wifi-test.cc	Tue Jan 19 17:06:18 2010 +0100
@@ -143,7 +143,7 @@
   m_propDelay.SetTypeId ("ns3::RandomPropagationDelayModel");
   m_mac.SetTypeId ("ns3::AdhocWifiMac");
   RunOne ();
-
+  Simulator::Destroy ();
   return false;
 }
 
--- a/src/helper/ipv4-address-helper.cc	Tue Jan 19 17:02:38 2010 +0100
+++ b/src/helper/ipv4-address-helper.cc	Tue Jan 19 17:06:18 2010 +0100
@@ -23,6 +23,7 @@
 #include "ns3/net-device.h"
 #include "ns3/ipv4.h"
 #include "ns3/ipv4-address-generator.h"
+#include "ns3/simulator.h"
 #include "ipv4-address-helper.h"
 
 NS_LOG_COMPONENT_DEFINE("Ipv4AddressHelper");
@@ -200,6 +201,7 @@
 NetworkAllocatorHelperTestCase::DoTeardown (void)
 {
   Ipv4AddressGenerator::Reset ();
+  Simulator::Destroy ();
 }
 bool
 NetworkAllocatorHelperTestCase::DoRun (void)
@@ -246,6 +248,7 @@
 AddressAllocatorHelperTestCase::DoTeardown (void)
 {
   Ipv4AddressGenerator::Reset ();
+  Simulator::Destroy ();
 }
 
 bool
@@ -337,6 +340,7 @@
 ResetAllocatorHelperTestCase::DoTeardown (void)
 {
   Ipv4AddressGenerator::Reset ();
+  Simulator::Destroy ();
 }
 
 static class Ipv4AddressHelperTestSuite : public TestSuite
--- a/src/internet-stack/ipv4-test.cc	Tue Jan 19 17:02:38 2010 +0100
+++ b/src/internet-stack/ipv4-test.cc	Tue Jan 19 17:06:18 2010 +0100
@@ -94,7 +94,7 @@
   Ipv4InterfaceAddress output = interface->GetAddress (2);
   NS_TEST_ASSERT_MSG_EQ (ifaceAddr4, output,
       "The addresses should be identical");
-
+  Simulator::Destroy ();
   return false;
 }
 
--- a/src/internet-stack/ipv6-test.cc	Tue Jan 19 17:02:38 2010 +0100
+++ b/src/internet-stack/ipv6-test.cc	Tue Jan 19 17:06:18 2010 +0100
@@ -135,7 +135,7 @@
 
   index = ipv6->GetInterfaceForAddress ("2001:ffff:5678:9000::1"); /* address we just remove */
   NS_TEST_ASSERT_MSG_EQ (index, (uint32_t) -1, "Address should not be found??");
-
+  Simulator::Destroy ();
   return false;
 }//end DoRun
 static class IPv6L3ProtocolTestSuite : public TestSuite
--- a/src/node/ipv4-address-generator.cc	Tue Jan 19 17:02:38 2010 +0100
+++ b/src/node/ipv4-address-generator.cc	Tue Jan 19 17:06:18 2010 +0100
@@ -560,6 +560,7 @@
 AddressAllocatorTestCase::DoTeardown (void)
 {
   Ipv4AddressGenerator::Reset ();
+  Simulator::Destroy ();
 }
 
 
@@ -579,6 +580,7 @@
 NetworkAndAddressTestCase::DoTeardown (void)
 {
   Ipv4AddressGenerator::Reset ();
+  Simulator::Destroy ();
 }
 
 bool
@@ -695,6 +697,7 @@
 AddressCollisionTestCase::DoTeardown (void)
 {
   Ipv4AddressGenerator::Reset ();
+  Simulator::Destroy ();
 }
 bool
 AddressCollisionTestCase::DoRun (void)
--- a/src/routing/aodv/aodv-test-suite.cc	Tue Jan 19 17:02:38 2010 +0100
+++ b/src/routing/aodv/aodv-test-suite.cc	Tue Jan 19 17:06:18 2010 +0100
@@ -474,7 +474,7 @@
     NS_TEST_EXPECT_MSG_EQ (rt.IsPrecursorListEmpty (), true, "trivial");
     rt.GetPrecursors (prec);
     NS_TEST_EXPECT_MSG_EQ (prec.size (), 2, "trivial");
-
+    Simulator::Destroy ();
     return GetErrorStatus ();
   }
 };
@@ -528,7 +528,7 @@
     NS_TEST_EXPECT_MSG_EQ (rt.GetFlag (), INVALID, "trivial");
     NS_TEST_EXPECT_MSG_EQ (rtable.DeleteRoute (Ipv4Address ("1.2.3.4")), true, "trivial");
     NS_TEST_EXPECT_MSG_EQ (rtable.DeleteRoute (Ipv4Address ("1.2.3.4")), false, "trivial");
-
+    Simulator::Destroy ();
     return GetErrorStatus ();
   }
 };