diff options
-rw-r--r-- | src/Boundary.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Boundary.c b/src/Boundary.c index 0907d91..f000108 100644 --- a/src/Boundary.c +++ b/src/Boundary.c @@ -768,6 +768,7 @@ void Boundary_ApplyPhysicalBCs(CCTK_ARGUMENTS) { struct BCDATA *current_bcdata; max_num_vars = 0; + vars = NULL; /* so that it won't be freed if it was never malloced */ /* Step through each requested physical boundary condition */ for (current_bcdata = bcdata_list; @@ -834,8 +835,11 @@ void Boundary_ApplyPhysicalBCs(CCTK_ARGUMENTS) { } /* Free data */ - free(vars); - free(tables); + if (vars) + { + free(vars); + free(tables); + } } /*@@ |