[MOAB-dev] r4179 - in MOAB/trunk/src/io: . mhdf/include mhdf/src

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Tue Sep 28 14:47:05 CDT 2010


Author: kraftche
Date: 2010-09-28 14:47:05 -0500 (Tue, 28 Sep 2010)
New Revision: 4179

Modified:
   MOAB/trunk/src/io/ReadHDF5.cpp
   MOAB/trunk/src/io/mhdf/include/mhdf.h
   MOAB/trunk/src/io/mhdf/src/file.c
Log:
fix resource leak causing test failures

Modified: MOAB/trunk/src/io/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/ReadHDF5.cpp	2010-09-28 19:25:39 UTC (rev 4178)
+++ MOAB/trunk/src/io/ReadHDF5.cpp	2010-09-28 19:47:05 UTC (rev 4179)
@@ -1151,6 +1151,7 @@
         offset += count;
       }
       if (offset != num_nodes) {
+        mhdf_closeData( filePtr, data_id, &status );
         assert(false);
         return MB_FAILURE;
       }
@@ -1160,7 +1161,6 @@
     mhdf_closeData( filePtr, data_id, &status );
     return error(MB_FAILURE);
   }
-  mhdf_closeData( filePtr, data_id, &status );
 #else
   double* buffer = (double*)dataBuffer;
   long chunk_size = bufferSize / (3*sizeof(double));
@@ -1183,9 +1183,11 @@
     }
   }
   catch (ReadHDF5Dataset::Exception) {
+    mhdf_closeData( filePtr, data_id, &status );
     return error(MB_FAILURE);
   }
 #endif
+  mhdf_closeData( filePtr, data_id, &status );
   for (int d = dim; d < cdim; ++d)
     memset( arrays[d], 0, num_nodes*sizeof(double) );
     

Modified: MOAB/trunk/src/io/mhdf/include/mhdf.h
===================================================================
--- MOAB/trunk/src/io/mhdf/include/mhdf.h	2010-09-28 19:25:39 UTC (rev 4178)
+++ MOAB/trunk/src/io/mhdf/include/mhdf.h	2010-09-28 19:47:05 UTC (rev 4179)
@@ -589,6 +589,11 @@
 mhdf_closeFile( mhdf_FileHandle handle,
                 mhdf_Status* status );
 
+/**\brief Check for open handles in file
+ **/
+int
+mhdf_checkOpenHandles( mhdf_FileHandle handle, mhdf_Status* status );
+
 /** \brief Common close function for all data handle types.
  *
  * Close an hid_t-type handle returned from any of the following

Modified: MOAB/trunk/src/io/mhdf/src/file.c


More information about the moab-dev mailing list