From 5352835c7e20ebf5fb6d5bcbfe4d4f310bd5bc9d Mon Sep 17 00:00:00 2001 From: schnetter Date: Wed, 23 Aug 2006 00:58:04 +0000 Subject: Handle the case of 0 interpolation points correctly. malloc can return NULL in this case. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/ReflectionSymmetry/trunk@16 082bdb00-0f4f-0410-b49e-b1835e5f2039 --- src/apply.c | 6 ++++++ src/interpolate.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/apply.c b/src/apply.c index 20f8993..6170234 100644 --- a/src/apply.c +++ b/src/apply.c @@ -591,6 +591,12 @@ ReflectionSymmetry_Apply (CCTK_ARGUMENTS) CCTK_WARN (0, "Internal error in Boundary_SelectedGVs"); } + if (nvars == 0) + { + /* Nothing to do */ + return; + } + indices = malloc (nvars * sizeof *indices); if (! indices) { diff --git a/src/interpolate.c b/src/interpolate.c index 9d52c9a..884abe6 100644 --- a/src/interpolate.c +++ b/src/interpolate.c @@ -88,7 +88,7 @@ ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_, { new_interp_coords[dir] = malloc (N_interp_points * sizeof (CCTK_REAL)); - assert (new_interp_coords[dir]); + assert (N_interp_points == 0 || new_interp_coords[dir]); for (n=0; n