diff options
author | schnetter <schnetter@20f44201-0f4f-0410-9130-e5fc2714a787> | 2005-04-29 15:50:42 +0000 |
---|---|---|
committer | schnetter <schnetter@20f44201-0f4f-0410-9130-e5fc2714a787> | 2005-04-29 15:50:42 +0000 |
commit | e8f37263341ef6c014695e6069ad40121c615883 (patch) | |
tree | 159ba53762a60a2a55e992be49747f49815a41a2 /src | |
parent | 930ae3a73f6ea436372fc0237942527d1d7e4d50 (diff) |
Do not access freed memory
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/RotatingSymmetry180/trunk@17 20f44201-0f4f-0410-9130-e5fc2714a787
Diffstat (limited to 'src')
-rw-r--r-- | src/rotatingsymmetry180.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/rotatingsymmetry180.c b/src/rotatingsymmetry180.c index acc1848..6b019fc 100644 --- a/src/rotatingsymmetry180.c +++ b/src/rotatingsymmetry180.c @@ -266,38 +266,38 @@ int BndRot180VI (cGH const * restrict const cctkGH, group.vartype, varptr, group.vartype, varptr); assert (!ierr); - free (xferinfo); - - } /* if global_bbox */ - - /* take parity into account */ - if (cctkGH->cctk_bbox[2*dir]) { - int parity; - - parity = parities[0] * parities[1]; - assert (abs(parity) == 1); - if (parity == -1) { - int imin[3], imax[3]; - int i, j, k; - for (d=0; d<3; ++d) { - imin[d] = xferinfo[d].dst.off; - imax[d] = xferinfo[d].dst.off + xferinfo[d].dst.len; - imin[d] -= cctk_lbnd[d]; - imax[d] -= cctk_lbnd[d]; - if (imin[d] < 0) imin[d] = 0; - if (imax[d] >= cctk_lsh[d]) imax[d] = cctk_lsh[d]; - } - assert (group.dim == 3); - assert (group.vartype == CCTK_VARIABLE_REAL); - for (k=imin[0]; k<imax[2]; ++k) { - for (j=imin[1]; j<imax[1]; ++j) { - for (i=imin[2]; i<imax[0]; ++i) { - const int ind = CCTK_GFINDEX3D(cctkGH, i, j, k); - ((CCTK_REAL *) varptr) [ind] *= -1; + /* take parity into account */ + if (cctkGH->cctk_bbox[2*dir]) { + int parity; + + parity = parities[0] * parities[1]; + assert (abs(parity) == 1); + if (parity == -1) { + int imin[3], imax[3]; + int i, j, k; + for (d=0; d<3; ++d) { + imin[d] = xferinfo[d].dst.off; + imax[d] = xferinfo[d].dst.off + xferinfo[d].dst.len; + imin[d] -= cctk_lbnd[d]; + imax[d] -= cctk_lbnd[d]; + if (imin[d] < 0) imin[d] = 0; + if (imax[d] >= cctk_lsh[d]) imax[d] = cctk_lsh[d]; + } + assert (group.dim == 3); + assert (group.vartype == CCTK_VARIABLE_REAL); + for (k=imin[0]; k<imax[2]; ++k) { + for (j=imin[1]; j<imax[1]; ++j) { + for (i=imin[2]; i<imax[0]; ++i) { + const int ind = CCTK_GFINDEX3D(cctkGH, i, j, k); + ((CCTK_REAL *) varptr) [ind] *= -1; + } } } } - } + + free (xferinfo); + + } /* if global_bbox */ } /* if bbox */ |