diff options
author | tradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a> | 2004-05-06 15:53:22 +0000 |
---|---|---|
committer | tradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a> | 2004-05-06 15:53:22 +0000 |
commit | 4baafb06b93c50c836bc178b2bd99a7edaff9163 (patch) | |
tree | e18d99d4a703904ab9d191acfe5ed8b9bffc6f81 | |
parent | b41fa2453d61324745251fb793a31220917c265e (diff) |
Fixed memory allocation bug when reading string attributes.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@319 ebee0441-1374-4afa-a3b5-247f3ba15b9a
-rw-r--r-- | src/util/ieee_recombiner.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/ieee_recombiner.c b/src/util/ieee_recombiner.c index 4b44ba9..76b7823 100644 --- a/src/util/ieee_recombiner.c +++ b/src/util/ieee_recombiner.c @@ -718,7 +718,9 @@ void copyAttributes (IOFile infile, IOFile outfile, int nprocs, #endif /* copy from Long to int */ tmp_int = num_elems; - buffer = malloc (IOnBytes (datatype, 1, &tmp_int)); + + /* add one more byte for trailing '\0' characters in string attributes */ + buffer = malloc (1 + IOnBytes (datatype, 1, &tmp_int)); IOreadAttribute (infile, attr, buffer); /* reset 'GH$nprocs', 'GH$ioproc_every', and 'unchunked' attributes |