aboutsummaryrefslogtreecommitdiff
path: root/src/CopyBoundary.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/CopyBoundary.c')
-rw-r--r--src/CopyBoundary.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/CopyBoundary.c b/src/CopyBoundary.c
index 278482f..e8a60b2 100644
--- a/src/CopyBoundary.c
+++ b/src/CopyBoundary.c
@@ -181,15 +181,11 @@ int BndCopy(const cGH *GH, int num_vars, int *vars, int *faces, int *widths,
}
/* Determine boundary width on all faces */
- /* allocate memory for buffer */
+ /* (re-)allocate memory for buffer */
gdim = CCTK_GroupDimI(gi);
- if (!width_alldirs)
+ if (gdim > max_gdim)
{
- width_alldirs = (int *) malloc(2*gdim*sizeof(int));
- max_gdim = gdim;
- } else if (gdim > max_gdim)
- {
- width_alldirs = realloc(width_alldirs, gdim*sizeof(int));
+ width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(int));
max_gdim = gdim;
}