[MOAB-dev] r1708 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Thu Mar 27 12:39:22 CDT 2008


Author: kraftche
Date: 2008-03-27 12:39:22 -0500 (Thu, 27 Mar 2008)
New Revision: 1708

Modified:
   MOAB/trunk/ReadHDF5.cpp
Log:
o Check return status of mhdf_closeFile. (Will fail if reader doesn't
   release all resources in hdf5 library.)
o Fix resource leak in hdf5 library when reading old-format 
   polyhedron/polygon data.


Modified: MOAB/trunk/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/ReadHDF5.cpp	2008-03-26 16:33:23 UTC (rev 1707)
+++ MOAB/trunk/ReadHDF5.cpp	2008-03-27 17:39:22 UTC (rev 1708)
@@ -238,6 +238,11 @@
   filePtr = 0;
   elemList.clear();
   if (groups) free( groups );
+  if (mhdf_isError( &status ))
+  {
+    readUtil->report_error( mhdf_message( &status ));
+    return MB_FAILURE;
+  }
   return MB_SUCCESS;
   
 read_fail:
@@ -516,7 +521,18 @@
     elemList.back().range.insert( h );
   }
  
-  return MB_SUCCESS;
+  MBErrorCode result = MB_SUCCESS;
+  mhdf_closeData( filePtr, handles[0], &status );
+  if (mhdf_isError( &status )) {
+    readUtil->report_error( mhdf_message( &status ));
+    result = MB_FAILURE;
+  }
+  mhdf_closeData( filePtr, handles[1], &status );
+  if (mhdf_isError( &status )) {
+    readUtil->report_error( mhdf_message( &status ));
+    result = MB_FAILURE;
+  }
+  return result;
 }
 
 template <typename T>




More information about the moab-dev mailing list