aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5>2006-08-23 00:58:27 +0000
committerschnetter <schnetter@c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5>2006-08-23 00:58:27 +0000
commit858f0f9aa64d43a781fa379e0854209acf94c16a (patch)
tree18111fd21410096e97fee9231e509c8ea1809389
parentc3a7d00dbef7a0c42eb5e47bbfc0c608878a54b1 (diff)
Handle the case of 0 interpolation points correctly. malloc can
return NULL in this case. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/RotatingSymmetry90/trunk@38 c3c03602-0f4f-0410-b3fa-d2c81c8a7dc5
-rw-r--r--src/interpolate.c4
-rw-r--r--src/rotatingsymmetry90.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/interpolate.c b/src/interpolate.c
index 80a11c1..30a18f8 100644
--- a/src/interpolate.c
+++ b/src/interpolate.c
@@ -455,7 +455,7 @@ Rot90_SymmetryInterpolate (CCTK_POINTER_TO_CONST const cctkGH_,
/* Copy coordinates */
for (d=0; d<DIM; ++d) {
new_interp_coords[d] = malloc (N_interp_points * sizeof(CCTK_REAL));
- assert (new_interp_coords[d]);
+ assert (N_interp_points == 0 || new_interp_coords[d]);
}
/* Fold coordinates */
@@ -487,7 +487,7 @@ Rot90_SymmetryInterpolate (CCTK_POINTER_TO_CONST const cctkGH_,
assert (new_output_arrays);
for (m=0; m<N_output_arrays; ++m) {
new_output_arrays[m] = malloc (N_interp_points * sizeof(CCTK_REAL));
- assert (new_output_arrays[m]);
+ assert (N_interp_points == 0 || new_output_arrays[m]);
}
diff --git a/src/rotatingsymmetry90.c b/src/rotatingsymmetry90.c
index 8e89689..51150c4 100644
--- a/src/rotatingsymmetry90.c
+++ b/src/rotatingsymmetry90.c
@@ -594,6 +594,8 @@ void Rot90_ApplyBC (CCTK_ARGUMENTS)
nvars = Boundary_SelectedGVs (cctkGH, 0, 0, 0, 0, 0, 0);
assert (nvars>=0);
+ if (nvars==0) return;
+
indices = malloc (nvars * sizeof *indices);
assert (indices);
faces = malloc (nvars * sizeof *faces);