From ea76585f7d3b3942ee7e4f3c3d33356b1f35fdb5 Mon Sep 17 00:00:00 2001 From: rideout Date: Mon, 30 Dec 2002 18:42:56 +0000 Subject: Only free temporary arrays in Boundary_ApplyPhysicalBCs() if they have been allocated. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@188 6a38eb6e-646e-4a02-a296-d141613ad6c4 --- src/Boundary.c | 8 ++++++-- 1 file 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); + } } /*@@ -- cgit v1.2.3