diff options
author | tradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668> | 2005-07-26 15:03:04 +0000 |
---|---|---|
committer | tradke <tradke@7842ec3a-9562-4be5-9c5b-06ba18f2b668> | 2005-07-26 15:03:04 +0000 |
commit | 512b4bfb4f52cef51501d91c6135be1b2e7e72c6 (patch) | |
tree | 0a1a0881a7308279de3bc450452e1fb2be3c3485 | |
parent | 059d7cec79787b2c5081399ce75a49bad2733039 (diff) |
Fixed small memory when using Util_snprintf().
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@127 7842ec3a-9562-4be5-9c5b-06ba18f2b668
-rw-r--r-- | src/RecoverVar.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/RecoverVar.c b/src/RecoverVar.c index 593dda4..90072a2 100644 --- a/src/RecoverVar.c +++ b/src/RecoverVar.c @@ -384,7 +384,7 @@ static int GetCommonAttributes (const cGH *GH, hid_t datatype, dataspace; hsize_t rank_stored, *dims_stored; int grouptype_stored, numtimelevels_stored; - char *groupname, *msg; + char *groupname, *msg, *oldmsg; char groupname_stored[128]; @@ -513,16 +513,24 @@ static int GetCommonAttributes (const cGH *GH, fullname, (int) dims_stored[0]); for (i = 1; i < group_static_data.dim; i++) { + oldmsg = msg; Util_asprintf (&msg, "%s, %d", msg, (int) dims_stored[i]); + free (oldmsg); } dims = unchunked ? group_dynamic_data.gsh : group_dynamic_data.lsh; + oldmsg = msg; Util_asprintf (&msg, "%s), expected (%d", msg, dims[group_static_data.dim - 1]); + free (oldmsg); for (i = 1; i < group_static_data.dim; i++) { + oldmsg = msg; Util_asprintf (&msg, "%s, %d", msg, dims[group_static_data.dim-i-1]); + free (oldmsg); } + oldmsg = msg; Util_asprintf (&msg, "%s)", msg); + free (oldmsg); CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, msg); free (msg); } |