From ff02a695ef98e2adb25775c1d7054db32ea67913 Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 27 Oct 2003 13:23:39 +0000 Subject: Don't call CCTK_GroupgshVI() on grid scalar variables. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@194 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a --- src/Utils.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Utils.c b/src/Utils.c index 4870d61..e3b0274 100644 --- a/src/Utils.c +++ b/src/Utils.c @@ -951,8 +951,12 @@ ioRequest *IOUtil_DefaultIORequest (const cGH *GH, int vindex, /* get the variable's dimension and extents */ request->vdim = CCTK_GroupDimFromVarI (vindex); - extent_int = malloc (request->vdim * sizeof (int)); - CCTK_GroupgshVI (GH, request->vdim, extent_int, vindex); + extent_int = NULL; + if (request->vdim > 0) + { + extent_int = malloc (request->vdim * sizeof (int)); + CCTK_GroupgshVI (GH, request->vdim, extent_int, vindex); + } /* allocate the arrays all in one go only initialize those which are mandatory for the Hyperslab API */ @@ -991,7 +995,10 @@ ioRequest *IOUtil_DefaultIORequest (const cGH *GH, int vindex, } /* clean up */ - free (extent_int); + if (extent_int) + { + free (extent_int); + } return (request); } -- cgit v1.2.3