From ab65ac40746215424100ed2e3979ebde333a3384 Mon Sep 17 00:00:00 2001 From: knarf Date: Fri, 18 Sep 2009 21:21:46 +0000 Subject: Make sure we do not call malloc(0). This should not be harmful, but better be safe. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@498 b61c5cb5-eaca-4651-9a7a-d64986f99364 --- src/Topology.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Topology.c b/src/Topology.c index 4849ba9..4b4b460 100644 --- a/src/Topology.c +++ b/src/Topology.c @@ -243,7 +243,7 @@ static int FranksTopology(int dim, int max_dir, max_length; int free_procs = total_procs-1; int used_procs = 1; - int *my_nprocs = (int*)malloc(dim*sizeof(int)); + int *my_nprocs; /* Nothing to decompose here */ if (dim == 0) @@ -251,6 +251,7 @@ static int FranksTopology(int dim, return TraditionalTopology(dim, total_procs, nsize, nghostzones, nprocs); } + my_nprocs = (int*)malloc(dim*sizeof(int)); /* start with a single domain */ for (i = 0; i < dim; i++) -- cgit v1.2.3