From d1f6efa8c0b7e9da167d6072a285ad0943016bdc Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 16 Dec 2010 15:09:28 +0000 Subject: [PATCH] - missing memory release for te and td structure implemented --- src/h5core/h5_maps.c | 6 ++++-- src/h5core/h5t_adjacencies_tetm.c | 14 ++++++++++++-- src/h5core/h5t_adjacencies_trim.c | 12 +++++++++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/h5core/h5_maps.c b/src/h5core/h5_maps.c index bbf211c..2ce250f 100644 --- a/src/h5core/h5_maps.c +++ b/src/h5core/h5_maps.c @@ -31,14 +31,16 @@ h5priv_free_idlist_items ( return H5_SUCCESS; } +/* + Allocate new/empty id-list + */ h5_err_t h5priv_alloc_idlist ( h5_file_t* const f, h5_idlist_t** list, const h5_size_t size ) { - TRY( (*list = h5_alloc (f, NULL, sizeof (**list))) ); - memset (*list, 0, sizeof (**list)); + TRY( (*list = h5_calloc (f, 1, sizeof (**list))) ); size_t size_in_bytes = size * sizeof ((*list)->items[0]); TRY( (*list)->items = h5_alloc (f, (*list)->items, size_in_bytes) ); (*list)->size = size; diff --git a/src/h5core/h5t_adjacencies_tetm.c b/src/h5core/h5t_adjacencies_tetm.c index 435f5ab..fcbfa3c 100644 --- a/src/h5core/h5t_adjacencies_tetm.c +++ b/src/h5core/h5t_adjacencies_tetm.c @@ -80,12 +80,22 @@ compute_elems_of_vertices ( return H5_SUCCESS; } +static h5_err_t +free_idlist ( + h5_file_t * const f, + const void* __list + ) { + h5_idlist_t* list = *(h5_idlist_t**)__list; + TRY( h5priv_free_idlist (f, &list) ); + return H5_SUCCESS; +} + static inline h5_err_t release_te ( h5_file_t* const f ) { UNUSED_ARGUMENT (f); - // TODO + TRY( h5priv_hwalk (f, &f->t->adjacencies.te_hash, free_idlist) ); return H5_SUCCESS; } @@ -118,7 +128,7 @@ release_td ( h5_file_t* const f ) { UNUSED_ARGUMENT (f); - // TODO + TRY( h5priv_hwalk (f, &f->t->adjacencies.td_hash, free_idlist) ); return H5_SUCCESS; } diff --git a/src/h5core/h5t_adjacencies_trim.c b/src/h5core/h5t_adjacencies_trim.c index 72adcc1..725bcb9 100644 --- a/src/h5core/h5t_adjacencies_trim.c +++ b/src/h5core/h5t_adjacencies_trim.c @@ -82,12 +82,22 @@ compute_elems_of_vertices ( return H5_SUCCESS; } +static h5_err_t +free_idlist ( + h5_file_t * const f, + const void* __list + ) { + h5_idlist_t* list = *(h5_idlist_t**)__list; + TRY( h5priv_free_idlist (f, &list) ); + return H5_SUCCESS; +} + static inline h5_err_t release_te ( h5_file_t* const f ) { UNUSED_ARGUMENT (f); - // TODO + TRY( h5priv_hwalk (f, &f->t->adjacencies.te_hash, free_idlist) ); return H5_SUCCESS; }