Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an entry for GH-4585 #4888

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,15 @@ Bug Fixes since HDF5-1.14.0 release
===================================
Library
-------
- Fixed a memory leak in H5F__accum_write()

The memory was allocated in H5F__accum_write() and was to be freed in
H5F__accum_reset() during the closing process but a failure occurred just
before the deallocation, leaving the memory un-freed. The problem is
now fixed.

Fixes GitHub #4585

- Fixed an incorrect returned value by H5LTfind_dataset()

H5LTfind_dataset() returned true for non-existing datasets because it only
Expand Down
13 changes: 8 additions & 5 deletions src/H5Faccum.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s
/* Make certain that data in accumulator is visible before new write */
if ((H5F_SHARED_INTENT(f_sh) & H5F_ACC_SWMR_WRITE) > 0)
/* Flush if dirty and reset accumulator */
if (H5F__accum_reset(f_sh, true) < 0)
if (H5F__accum_reset(f_sh, true, false) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator");

/* Write the data */
Expand Down Expand Up @@ -776,7 +776,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s
} /* end if */
else { /* Access covers whole accumulator */
/* Reset accumulator, but don't flush */
if (H5F__accum_reset(f_sh, false) < 0)
if (H5F__accum_reset(f_sh, false, false) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator");
} /* end else */
} /* end if */
Expand Down Expand Up @@ -1039,7 +1039,7 @@ H5F__accum_flush(H5F_shared_t *f_sh)
*-------------------------------------------------------------------------
*/
herr_t
H5F__accum_reset(H5F_shared_t *f_sh, bool flush)
H5F__accum_reset(H5F_shared_t *f_sh, bool flush, bool force)
{
herr_t ret_value = SUCCEED; /* Return value */

Expand All @@ -1050,8 +1050,11 @@ H5F__accum_reset(H5F_shared_t *f_sh, bool flush)

/* Flush any dirty data in accumulator, if requested */
if (flush)
if (H5F__accum_flush(f_sh) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator");
if (H5F__accum_flush(f_sh) < 0) {
HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator");
if (!force)
HGOTO_DONE(FAIL);
}

/* Check if we need to reset the metadata accumulator information */
if (f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) {
Expand Down
4 changes: 2 additions & 2 deletions src/H5Fint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@ H5F__dest(H5F_t *f, bool flush, bool free_on_failure)
} /* end if */

/* Destroy other components of the file */
if (H5F__accum_reset(f->shared, true) < 0)
if (H5F__accum_reset(f->shared, true, true) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file");
if (H5FO_dest(f) < 0)
Expand Down Expand Up @@ -3893,7 +3893,7 @@ H5F__start_swmr_write(H5F_t *f)
} /* end if */

/* Flush and reset the accumulator */
if (H5F__accum_reset(f->shared, true) < 0)
if (H5F__accum_reset(f->shared, true, false) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator");

/* Turn on SWMR write in shared file open flags */
Expand Down
2 changes: 1 addition & 1 deletion src/H5Fio.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata");

/* Flush and reset the accumulator */
if (H5F__accum_reset(f->shared, true) < 0)
if (H5F__accum_reset(f->shared, true, false) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator");

/* Flush file buffers to disk. */
Expand Down
2 changes: 1 addition & 1 deletion src/H5Fpkg.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ H5_DLL herr_t H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr
const void *buf);
H5_DLL herr_t H5F__accum_free(H5F_shared_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size);
H5_DLL herr_t H5F__accum_flush(H5F_shared_t *f_sh);
H5_DLL herr_t H5F__accum_reset(H5F_shared_t *f_sh, bool flush);
H5_DLL herr_t H5F__accum_reset(H5F_shared_t *f_sh, bool flush, bool force);

/* Shared file list related routines */
H5_DLL herr_t H5F__sfile_add(H5F_shared_t *shared);
Expand Down
2 changes: 1 addition & 1 deletion test/accum.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void accum_printf(const H5F_t *f);
#define accum_read(a, s, b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b))
#define accum_free(f, a, s) H5F__accum_free(f->shared, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
#define accum_flush(f) H5F__accum_flush(f->shared)
#define accum_reset(f) H5F__accum_reset(f->shared, true)
#define accum_reset(f) H5F__accum_reset(f->shared, true, false)

/* ================= */
/* Main Test Routine */
Expand Down
Loading