From: Arnaud Giersch Date: Mon, 10 Jan 2022 12:57:28 +0000 (+0100) Subject: Fix ccpcheck warning: Possible null pointer dereference: gateway. X-Git-Tag: v3.30~93 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/23f71d630a3a7d773acb2325e5f75fd3641af5b2?hp=f0c07d4ab3b94286d109ff88493b01c082ad70cb Fix ccpcheck warning: Possible null pointer dereference: gateway. --- diff --git a/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp b/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp index 288e5a45ba..ec75a90c45 100644 --- a/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp +++ b/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp @@ -102,14 +102,14 @@ create_hostzone(const sg4::NetZone* zone, const std::vector& /*co /* setting my Torus parent zone */ host_zone->set_parent(zone); - const sg4::Host* gateway = nullptr; + simgrid::kernel::routing::NetPoint* gateway = nullptr; /* create CPUs */ for (int i = 0; i < num_cpus; i++) { std::string cpu_name = hostname + "-cpu" + std::to_string(i); const sg4::Host* host = host_zone->create_host(cpu_name, speed)->seal(); /* the first CPU is the gateway */ if (i == 0) - gateway = host; + gateway = host->get_netpoint(); /* create split-duplex link */ sg4::SplitDuplexLink* link = host_zone->create_split_duplex_link("link-" + cpu_name, link_bw); link->set_latency(link_lat)->seal(); @@ -119,7 +119,7 @@ create_hostzone(const sg4::NetZone* zone, const std::vector& /*co } /* seal newly created netzone */ host_zone->seal(); - return std::make_pair(host_zone->get_netpoint(), gateway->get_netpoint()); + return std::make_pair(host_zone->get_netpoint(), gateway); } /*************************************************************************************************/