summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>2000-10-31 16:18:34 (GMT)
committerRobb Matzke <matzke@llnl.gov>2000-10-31 16:18:34 (GMT)
commit3c623ea000f9535cda6a8d8df93f891549cee659 (patch)
tree7ad3ee0d27d7eba24dde06f87c03bba79812473a /src
parent7f7ab4a16398414999856c8402cb43f704cad044 (diff)
downloadhdf5-3c623ea000f9535cda6a8d8df93f891549cee659.zip
hdf5-3c623ea000f9535cda6a8d8df93f891549cee659.tar.gz
hdf5-3c623ea000f9535cda6a8d8df93f891549cee659.tar.bz2
[svn-r2763] ./hdf5/src/H5F.c
* 2000-10-31 Robb Matzke <matzke@llnl.gov> (H5F_dest) Do not call H5FL_FREE() if the root group object is null. This fixes a bug in h5ls when that tool is given a file which is not an hdf5 file.
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 475c364..64d9057 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -806,6 +806,10 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id)
* More careful about decrementing reference counts so they don't go
* negative or wrap around to some huge value. Nothing happens if a
* reference count is already zero.
+ *
+ * Robb Matzke, 2000-10-31
+ * H5FL_FREE() aborts if called with a null pointer (unlike the
+ * original H5MM_free()).
*-------------------------------------------------------------------------
*/
static herr_t
@@ -821,8 +825,10 @@ H5F_dest(H5F_t *f)
* Do not close the root group since we didn't count it, but free
* the memory associated with it.
*/
- H5FL_FREE(H5G_t,f->shared->root_grp);
- f->shared->root_grp=NULL;
+ if (f->shared->root_grp) {
+ H5FL_FREE(H5G_t,f->shared->root_grp);
+ f->shared->root_grp=NULL;
+ }
if (H5AC_dest(f)) {
HERROR(H5E_FILE, H5E_CANTINIT, "problems closing file");
ret_value = FAIL; /*but keep going*/