From d2e47093cd0a36f75abff59806ea1fec228cffe9 Mon Sep 17 00:00:00 2001 From: Quincy Tse Date: Tue, 10 Aug 2010 22:33:13 -0400 Subject: [PATCH] Bug 930 - examples/topology-read/topology-example-sim.cc uses variable length array --- examples/topology-read/topology-example-sim.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/topology-read/topology-example-sim.cc b/examples/topology-read/topology-example-sim.cc index 740e5fe28..f70e072ad 100644 --- a/examples/topology-read/topology-example-sim.cc +++ b/examples/topology-read/topology-example-sim.cc @@ -119,7 +119,7 @@ int main (int argc, char *argv[]) int totlinks = inFile->LinksSize (); NS_LOG_INFO ("creating node containers"); - NodeContainer nc[totlinks]; + NodeContainer* nc = new NodeContainer[totlinks]; TopologyReader::ConstLinksIterator iter; int i = 0; for ( iter = inFile->LinksBegin (); iter != inFile->LinksEnd (); iter++, i++ ) @@ -128,7 +128,7 @@ int main (int argc, char *argv[]) } NS_LOG_INFO ("creating net device containers"); - NetDeviceContainer ndc[totlinks]; + NetDeviceContainer* ndc = new NetDeviceContainer[totlinks]; PointToPointHelper p2p; for (int i = 0; i < totlinks; i++) { @@ -140,7 +140,7 @@ int main (int argc, char *argv[]) // it crates little subnets, one for each couple of nodes. NS_LOG_INFO ("creating ipv4 interfaces"); - Ipv4InterfaceContainer ipic[totlinks]; + Ipv4InterfaceContainer* ipic = new Ipv4InterfaceContainer[totlinks]; for (int i = 0; i < totlinks; i++) { ipic[i] = address.Assign (ndc[i]); @@ -200,6 +200,10 @@ int main (int argc, char *argv[]) Simulator::Run (); Simulator::Destroy (); + delete[] ipic; + delete[] ndc; + delete[] nc; + NS_LOG_INFO ("Done."); return 0;