summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2011-04-25 16:59:51 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2011-04-25 16:59:51 (GMT)
commit65794c39bffdb5209849b016bde0b43166a73d7d (patch)
treefd5e55565a7b45a200dcac855035ab37bfffbb4e /tools/lib/h5tools.c
parent9f1262f9570b9e623f25f632d8730131897980ab (diff)
downloadhdf5-65794c39bffdb5209849b016bde0b43166a73d7d.zip
hdf5-65794c39bffdb5209849b016bde0b43166a73d7d.tar.gz
hdf5-65794c39bffdb5209849b016bde0b43166a73d7d.tar.bz2
[svn-r20626] Albert's test on bp reveals that the dumper had assertion failure when it tried to display empty attribute data. I added
a check for empty attribute in h5dump.c. I also added a check for empty dataset in tools/lib/h5tools.c. Tested on jam. But I tested the same changes in 1.8 on jam, linew, and amani.
Diffstat (limited to 'tools/lib/h5tools.c')
-rw-r--r--tools/lib/h5tools.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 5c8631e..bf85bc2 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -2545,6 +2545,9 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info,
}
}
+ if(!sm_nbytes)
+ goto done;
+
assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/
sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes);
@@ -2619,11 +2622,12 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info,
fputs(OPT(info->line_sep, ""), stream);
}
+ HDfree(sm_buf);
+
+done:
H5Sclose(sm_space);
H5Sclose(f_space);
- HDfree(sm_buf);
-
return SUCCEED;
}