aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@b61c5cb5-eaca-4651-9a7a-d64986f99364>2009-09-18 21:21:46 +0000
committerknarf <knarf@b61c5cb5-eaca-4651-9a7a-d64986f99364>2009-09-18 21:21:46 +0000
commitab65ac40746215424100ed2e3979ebde333a3384 (patch)
treebbd81156a7e1efd3cdfcd11f27b16da5d5c71ed4
parenta6345d6e112cf83d6c1a60f9049524b30aa1a0ae (diff)
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
-rw-r--r--src/Topology.c3
1 files changed, 2 insertions, 1 deletions
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++)