[svn-r27943] Purpose: Fix HDFFV-7947 (cont.)

Description:
    In the friend functions that setId, changed the direct assignment of
    id to using p_setId() so that the previous id can be closed first to
    avoid memory leaks.
    This change was tested and confirmed by user Jorj on Forum when his
    application stopped running out of memory.  Currently, the C++ library
    doesn't have a way to test this.  A function such as H5Inmembers for
    library ids would be helpful.
Platforms tested:
    Linux/32 2.6 (jam)
    SunOS 5.11 (emu)
    Darwin (osx1010test)
This commit is contained in:
Binh-Minh Ribler 2015-10-03 13:56:21 -05:00
parent 87cc068ccb
commit 0ef29b550b
2 changed files with 4 additions and 4 deletions

View File

@ -1268,7 +1268,7 @@ CommonFG::~CommonFG() {}
//--------------------------------------------------------------------------
void f_DataType_setId(DataType* dtype, hid_t new_id)
{
dtype->id = new_id;
dtype->p_setId(new_id);
}
//--------------------------------------------------------------------------
@ -1283,7 +1283,7 @@ void f_DataType_setId(DataType* dtype, hid_t new_id)
//--------------------------------------------------------------------------
void f_DataSet_setId(DataSet* dset, hid_t new_id)
{
dset->id = new_id;
dset->p_setId(new_id);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS

View File

@ -951,7 +951,7 @@ H5Location::~H5Location() {}
//--------------------------------------------------------------------------
void f_Attribute_setId(Attribute* attr, hid_t new_id)
{
attr->id = new_id;
attr->p_setId(new_id);
}
//--------------------------------------------------------------------------
@ -966,7 +966,7 @@ void f_Attribute_setId(Attribute* attr, hid_t new_id)
//--------------------------------------------------------------------------
void f_DataSpace_setId(DataSpace* dspace, hid_t new_id)
{
dspace->id = new_id;
dspace->p_setId(new_id);
}
#endif // DOXYGEN_SHOULD_SKIP_THIS