Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Address a few "null dereference" warnings from fbinfer.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 3 Jun 2022 14:29:57 +0000 (16:29 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 3 Jun 2022 15:19:41 +0000 (17:19 +0200)
src/kernel/routing/StarZone.cpp
teshsuite/smpi/replay-ti-colls/replay-ti-colls.c

index a6ef423..d698a2f 100644 (file)
@@ -110,7 +110,7 @@ void StarZone::check_add_route_param(const NetPoint* src, const NetPoint* dst, c
                              src->get_cname(), gw_src->get_cname()));
 
     const auto* netzone_src = get_netzone_recursive(src);
-    if (not netzone_src->is_component_recursive(gw_src))
+    if (not netzone_src || not netzone_src->is_component_recursive(gw_src))
       throw std::invalid_argument(xbt::string_printf(
           "Invalid NetzoneRoute from %s@%s to %s: gw_src %s belongs to %s, not to %s.", src_name, gw_src->get_cname(),
           dst_name, gw_src->get_cname(), gw_src->get_englobing_zone()->get_cname(), src_name));
@@ -126,7 +126,7 @@ void StarZone::check_add_route_param(const NetPoint* src, const NetPoint* dst, c
                              dst->get_cname(), gw_dst->get_cname()));
 
     const auto* netzone_dst = get_netzone_recursive(dst);
-    if (not netzone_dst->is_component_recursive(gw_dst))
+    if (not netzone_dst || not netzone_dst->is_component_recursive(gw_dst))
       throw std::invalid_argument(xbt::string_printf(
           "Invalid NetzoneRoute from %s@%s to %s: gw_dst %s belongs to %s, not to %s.", dst_name, gw_dst->get_cname(),
           src_name, gw_dst->get_cname(), gw_dst->get_englobing_zone()->get_cname(), dst_name));
index b7d24b0..ff300cb 100644 (file)
@@ -1,4 +1,5 @@
 #include "mpi.h"
+#include <assert.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -8,6 +9,7 @@
 static void setup_recvbuf(int nprocs, int** recvbuf, int** displs, int** counts, int** rcounts)
 {
   *recvbuf = malloc(BUFSIZE * nprocs * sizeof(int));
+  assert(*recvbuf != NULL);
   for (int i = 0; i < BUFSIZE * nprocs; i++)
     (*recvbuf)[i] = i;