diff options
author | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-05-14 18:45:07 (GMT) |
---|---|---|
committer | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-05-14 18:45:07 (GMT) |
commit | 453a3910ab7942daa7b01e821e15853cb7a0ba23 (patch) | |
tree | 04ef561bcd6f37bd07c1fea794cdbcfdc92bcd15 /src/H5I.c | |
parent | fbb8709e40c97724dbb6ab137b9fb480a59e4fa5 (diff) | |
download | hdf5-453a3910ab7942daa7b01e821e15853cb7a0ba23.zip hdf5-453a3910ab7942daa7b01e821e15853cb7a0ba23.tar.gz hdf5-453a3910ab7942daa7b01e821e15853cb7a0ba23.tar.bz2 |
[svn-r18805] Purpose:
Fix memory leaks
Description
Added a routine to free memory which addresses a memory leak
when variable length strings are used as fill values.
Also added some minor tweaks to the H5I 'save ID structures' mechanic.
Tested:
h5committest and valgrind (on jam/amani) to confirm freed memory.
Diffstat (limited to 'src/H5I.c')
-rw-r--r-- | src/H5I.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -362,8 +362,10 @@ H5I_register_type(H5I_type_t type_id, size_t hash_size, unsigned reserved, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "memory allocation failed") /* Don't re-use IDs for property lists, as this causes problems - * with some virtual file drivers. */ - if (type_id == H5I_GENPROP_LST) + * with some virtual file drivers. Also, open datatypes are not + * getting reduced to zero before file close in some situations, + * resulting in memory leak, so skip them for now as well. */ + if (type_id == H5I_GENPROP_LST || type_id == H5I_DATATYPE) type_ptr->reuse_ids = FALSE; else type_ptr->reuse_ids = TRUE; @@ -1355,6 +1357,7 @@ H5I_remove(hid_t id) tmp_id_ptr = type_ptr->next_id_ptr->next; (void)H5FL_FREE(H5I_id_info_t, type_ptr->next_id_ptr); type_ptr->next_id_ptr = tmp_id_ptr; + type_ptr->free_count--; } /* end while */ |