aboutsummaryrefslogtreecommitdiff
path: root/src/RestoreFile.c
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>1999-07-30 17:12:33 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>1999-07-30 17:12:33 +0000
commit317992b79e5f46cd3dc767462b4ddefe2c89792c (patch)
tree3bfef5746d4129d4928ad6fb34a463aef7d4417c /src/RestoreFile.c
parentca2e1f0feae534517fc7cf571d48085edd685e14 (diff)
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
Diffstat (limited to 'src/RestoreFile.c')
-rw-r--r--src/RestoreFile.c15
1 files changed, 9 insertions, 6 deletions
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;