mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-23 16:20:57 +08:00
Merge pull request #1747 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:vds_memory_bug to develop
* commit '8d67b440f7d94f1b191ce154a41685bcaa90fd12': Reset the other convenience pointer because why no Fixed a memory bug where a pointer is used after it's been freed.
This commit is contained in:
commit
10535e0376
@ -11612,11 +11612,11 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
|
||||
herr_t
|
||||
H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
|
||||
{
|
||||
H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */
|
||||
hsize_t orig_count; /* Original count in unlimited dimension */
|
||||
int orig_unlim_dim; /* Original unliminted dimension */
|
||||
H5S_hyper_dim_t *diminfo; /* Convenience pointer to diminfo.opt in unlimited dimension */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
H5S_hyper_sel_t *hslab = NULL; /* Convenience pointer to hyperslab info */
|
||||
hsize_t orig_count; /* Original count in unlimited dimension */
|
||||
int orig_unlim_dim; /* Original unliminted dimension */
|
||||
H5S_hyper_dim_t *diminfo = NULL; /* Convenience pointer to diminfo.opt in unlimited dimension */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
@ -11647,6 +11647,10 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
|
||||
/* Convert to "none" selection */
|
||||
if(H5S_select_none(space) < 0)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
|
||||
|
||||
/* Reset the convenience pointers */
|
||||
hslab = NULL;
|
||||
diminfo = NULL;
|
||||
} /* end if */
|
||||
/* Check for single block in unlimited dimension */
|
||||
else if(orig_count == (hsize_t)1) {
|
||||
@ -11699,7 +11703,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
|
||||
} /* end else */
|
||||
|
||||
/* Update the upper bound, if the diminfo is valid */
|
||||
if(H5S_DIMINFO_VALID_YES == hslab->diminfo_valid)
|
||||
if(hslab && (H5S_DIMINFO_VALID_YES == hslab->diminfo_valid))
|
||||
hslab->diminfo.high_bounds[orig_unlim_dim] =
|
||||
hslab->diminfo.opt[orig_unlim_dim].start +
|
||||
hslab->diminfo.opt[orig_unlim_dim].stride * (hslab->diminfo.opt[orig_unlim_dim].count - 1) +
|
||||
|
Loading…
Reference in New Issue
Block a user