changeset 27064:cc8182b32f60

maint: merge stable to default.
author Rik <rik@octave.org>
date Tue, 23 Apr 2019 15:57:08 -0700
parents ffdfeb835aef (current diff) eb25b491dad7 (diff)
children 2fd1ee5574d7
files
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/ls-hdf5.cc	Tue Apr 23 14:08:58 2019 -0700
+++ b/libinterp/corefcn/ls-hdf5.cc	Tue Apr 23 15:57:08 2019 -0700
@@ -717,10 +717,10 @@
       // check for OCTAVE_GLOBAL attribute:
       d->global = hdf5_check_attr (data_id, "OCTAVE_GLOBAL");
 
+      retval = (d->tc.load_hdf5 (group_id, name) ? 1 : -1);
+
       H5Tclose (type_id);
       H5Dclose (data_id);
-
-      retval = (d->tc.load_hdf5 (group_id, name) ? 1 : -1);
     }
 
   if (! ident_valid)
@@ -733,7 +733,11 @@
 
 done:
   if (retval < 0)
-    error ("load: error while reading hdf5 item %s", name);
+    {
+      // Must be warning.  A call to error aborts and leaves H5Giterate in
+      // a mangled state that causes segfault on exit (bug #56149).
+      warning ("load: error while reading hdf5 item '%s'", name);
+    }
 
   if (retval > 0)
     {
@@ -793,7 +797,7 @@
 }
 
 // Read the next Octave variable from the stream IS, which must really be an
-// hdf5_ifstream.  Return the variable value in tc, its doc string in doc, and
+// hdf5_ifstream.  Return the variable value in tc, its docstring in doc, and
 // whether it is global in global.  The return value is the name of the
 // variable, or NULL if none were found or there was an error.
 std::string
@@ -864,9 +868,9 @@
     }
   else
     {
-      // an error occurred (H5Giterate_retval < 0) or there are no
-      // more datasets print an error message if retval < 0?
-      // hdf5_read_next_data already printed one, probably.
+      // An error occurred (H5Giterate_retval < 0),
+      // or there are no more datasets (H5Giterate_retval == 0).
+      // hdf5_read_next_data_internal has already printed a warning msg.
     }
 
   if (! d.name.empty ())