aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2003-08-06 10:32:59 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2003-08-06 10:32:59 +0000
commitefb3165dec60c489c288ecc0a93ac21be569c18b (patch)
tree9a595adf2f018f0ee6aed3828ada95127455cfea
parent4fe1b10b73b5aa04074b243340b7e88b8e2a498a (diff)
Fixed small memory leak in parameter recovery. Found by Ed Evans.
This closes PR CactusPUGHIO/1578. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@285 ebee0441-1374-4afa-a3b5-247f3ba15b9a
-rw-r--r--src/RecoverGH.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/RecoverGH.c b/src/RecoverGH.c
index 3cbeeab..c2de6c1 100644
--- a/src/RecoverGH.c
+++ b/src/RecoverGH.c
@@ -2,10 +2,10 @@
@file RecoverGH.c
@date Fri Jun 19 09:14:22 1998
@author Tom Goodale
- @desc
+ @desc
Routines to recover variables from a given IEEEIO data or
checkpoint file.
- @enddesc
+ @enddesc
@version $Id$
@@*/
@@ -51,11 +51,11 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
@routine IOFlexIO_Recover
@date Fri Jun 19 09:22:52 1998
@author Tom Goodale
- @desc
+ @desc
Recovers a GH from an IEEEIO file.
This routine is registered with IOUtil as IOFlexIO's recovery
routine.
- @enddesc
+ @enddesc
@calls OpenFile
RecoverParameters
@@ -104,7 +104,7 @@ int IOFlexIO_Recover (cGH *GH, const char *basefilename, int called_from)
/* start the total timer */
if (GH)
{
- myGH = (flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
+ myGH = CCTK_GHExtension (GH, "IOFlexIO");
if (myGH->print_timing_info)
{
CCTK_TimerStartI (myGH->timers[3]);
@@ -204,7 +204,7 @@ int IOFlexIO_Recover (cGH *GH, const char *basefilename, int called_from)
/* print an info message */
if (called_from == CP_RECOVER_DATA)
{
- CCTK_VInfo (CCTK_THORNSTRING,
+ CCTK_VInfo (CCTK_THORNSTRING,
"Restarting simulation at iteration %d (physical time %g)",
GH->cctk_iteration, (double) GH->cctk_time);
}
@@ -217,8 +217,8 @@ int IOFlexIO_Recover (cGH *GH, const char *basefilename, int called_from)
@routine IOFlexIO_RecoverParameters
@date Thu Apr 13 2000
@author Thomas Radke
- @desc
- @desc
+ @desc
+ @desc
Recovers the parameters from an IEEEIO checkpoint file.
This routine is scheduled at CCTK_RECOVER_PARAMETERS.
@@ -233,7 +233,7 @@ int IOFlexIO_Recover (cGH *GH, const char *basefilename, int called_from)
Note also that this routine doesn't get passed any parameters,
not even a GH, because this doesn't exist yet at the time it is
being called.
- @enddesc
+ @enddesc
@calls IOUtil_RecoverParameters
@@ -348,7 +348,7 @@ static int OpenFile (cGH *GH, const char *basefilename, int called_from,
"Assuming it is 1 and continuing");
file->nprocs = 1;
}
-
+
/* determine whether data is chunked or unchunked
We could derive this from the filename itself but just to be sure ... */
i = IOreadAttributeInfo (file->fid, "unchunked", &type, &dim);
@@ -582,7 +582,7 @@ static int RecoverParameters (fileinfo_t *file)
if (i >= 0 && atype == FLEXIO_CHAR && asize > 0)
{
parameterSize = (CCTK_INT4) asize;
- parameters = (char *) malloc (parameterSize);
+ parameters = malloc (parameterSize + 1);
IOreadAttribute (file->fid, i, parameters);
}
else
@@ -606,7 +606,7 @@ static int RecoverParameters (fileinfo_t *file)
#ifdef CCTK_MPI
if (myproc)
{
- parameters = (char *) malloc (parameterSize + 1);
+ parameters = malloc (parameterSize + 1);
}
CACTUS_MPI_ERROR (MPI_Bcast (parameters, parameterSize + 1, PUGH_MPI_CHAR,