mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-31 17:10:47 +08:00
[svn-r18727] Purpose: Fixed bug 1719
Description: Closed a temporarily opened datatype to clean up memory leak, in getTypeClass. Platforms tested: Linux/32 2.6 (jam) FreeBSD/64 6.3 (liberty) SunOS 5.10 (linew)
This commit is contained in:
parent
809a91fad6
commit
ec7f4dc603
@ -81,15 +81,26 @@ H5T_class_t AbstractDs::getTypeClass() const
|
||||
|
||||
// Gets the class of the datatype and validate it before returning
|
||||
H5T_class_t type_class = H5Tget_class(datatype_id);
|
||||
if( type_class != H5T_NO_CLASS )
|
||||
return( type_class );
|
||||
else
|
||||
|
||||
// Close temporary datatype_id
|
||||
herr_t ret_value = H5Tclose(datatype_id);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
if (fromClass() == "DataSet")
|
||||
throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed");
|
||||
else if (fromClass() == "Attribute")
|
||||
throw DataTypeIException("Attribute::getTypeClass", "H5Tclose failed");
|
||||
}
|
||||
|
||||
// Check on the returned type_class
|
||||
if (type_class == H5T_NO_CLASS)
|
||||
{
|
||||
if (fromClass() == "DataSet")
|
||||
throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
|
||||
else if (fromClass() == "Attribute")
|
||||
throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
|
||||
}
|
||||
return(type_class);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user