From 317992b79e5f46cd3dc767462b4ddefe2c89792c Mon Sep 17 00:00:00 2001 From: tradke Date: Fri, 30 Jul 1999 17:12:33 +0000 Subject: Free the string returned by CCTK_GroupNameFromVarI after usage git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@25 ebee0441-1374-4afa-a3b5-247f3ba15b9a --- src/RestoreFile.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/RestoreFile.c') diff --git a/src/RestoreFile.c b/src/RestoreFile.c index e134864..659f8d8 100644 --- a/src/RestoreFile.c +++ b/src/RestoreFile.c @@ -67,7 +67,8 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index, CCTK_INT4 gtype_stored, ntimelevels_stored, timelevel_stored; int vtype, rank, ntimelevels; int result; - char fullname [512], groupname [512]; + char *groupname; + char fullname [512], groupname_stored [512]; char msg [160]; @@ -97,17 +98,19 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index, /* read and verify the group name */ i = IOreadAttributeInfo (ifp, "groupname", &atype, &asize); - if (i < 0 || (atype != BYTE && atype != CHAR) || asize >= sizeof (groupname)) { + if (i < 0 || (atype != BYTE && atype != CHAR) || asize >= sizeof (groupname_stored)) { sprintf (msg, "Can't read groupname attribute of '%s'", fullname); CCTK_WARN (2, msg); return (1); } - CACTUS_IEEEIO_ERROR (IOreadAttribute (ifp, i, groupname)); - if (! CCTK_Equals (groupname, CCTK_GroupNameFromVarI (*index))) { + CACTUS_IEEEIO_ERROR (IOreadAttribute (ifp, i, groupname_stored)); + groupname = CCTK_GroupNameFromVarI (*index); + if (! CCTK_Equals (groupname_stored, groupname)) { sprintf (msg, "Groupnames don't match for '%s'", fullname); CCTK_WARN (2, msg); return (1); } + free (groupname); /* read the group type */ i = IOreadAttributeInfo (ifp, "grouptype", &atype, &asize); @@ -138,7 +141,7 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index, *timelevel = timelevel_stored; /* verify group type, variable type, dims, sizes and ntimelevels */ - CCTK_GroupData (CCTK_GroupIndex (groupname), gtype, &vtype, &rank, + CCTK_GroupData (CCTK_GroupIndex (groupname_stored), gtype, &vtype, &rank, &i, &ntimelevels); if (*gtype != gtype_stored) { sprintf (msg, "Group types don't match for '%s'", fullname); @@ -179,7 +182,7 @@ int GetCommonAttributes (cGH *GH, IOFile ifp, int unchunked, int *index, case GROUP_ARRAY: /*** FIXME: what's the local size of the array ?? ***/ /* for (i = 0; i < rank; i++) - if (*(int *) CCTK_ArrayGroupSize (GH, i, groupname) != dims_stored [i]) + if (*(int *) CCTK_ArrayGroupSize (GH, i, groupname_stored) != dims_stored [i]) flag = 1; */ break; -- cgit v1.2.3