From 3a06e04ac5abb30d241118b83e2fc280e981a0b3 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Fri, 5 Mar 2010 12:05:02 -0500 Subject: [svn-r18372] Fix for bug #1773 - I added the call to H5O_msg_reset after H5D_chunk_bh_info to free the PLINE structure in the function H5O_dset_bh_info. This is to prevent memory leak. Tested on jam and tested 1.8 on jam, too - simple fix. --- src/H5Doh.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/H5Doh.c b/src/H5Doh.c index 42ec606..c6e33fb 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -359,6 +359,10 @@ done: * Programmer: Vailin Choi * July 11, 2007 * + * Modification:Raymond Lu + * 5 February, 2010 + * I added the call to H5O_msg_reset after H5D_chunk_bh_info + * to free the PLINE. *------------------------------------------------------------------------- */ static herr_t @@ -382,6 +386,7 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) /* Check for chunked dataset storage */ if(layout.type == H5D_CHUNKED && H5D_chunk_is_space_alloc(&layout.storage)) { H5O_pline_t pline; /* I/O pipeline message */ + herr_t ret = SUCCEED; /* Check for I/O pipeline message */ if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0) @@ -393,7 +398,12 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) else HDmemset(&pline, 0, sizeof(pline)); - if(H5D_chunk_bh_info(f, dxpl_id, &layout, &pline, &(bh_info->index_size)) < 0) + ret = H5D_chunk_bh_info(f, dxpl_id, &layout, &pline, &(bh_info->index_size)); + + /* Free the PLINE after using it */ + H5O_msg_reset(H5O_PLINE_ID, &pline); + + if(ret < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info") } /* end if */ -- cgit v0.12