mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-05 15:42:32 +08:00
[svn-r615] Fixed memory leaks & duplicates frees.
This commit is contained in:
parent
3ba4755c33
commit
75a293691e
@ -1668,6 +1668,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
|
||||
* enough value in xfer_parms since turning off data type conversion also
|
||||
* turns off background preservation.
|
||||
*/
|
||||
#ifdef QAK
|
||||
printf("%s: check 0.5, nelmts=%d, mem_space->rank=%d\n",FUNC,(int)nelmts,mem_space->extent.u.simple.rank);
|
||||
#endif /* QAK */
|
||||
if (nelmts!=H5S_select_npoints (file_space)) {
|
||||
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
|
||||
"src and dest data spaces have different sizes");
|
||||
|
@ -300,6 +300,7 @@ H5S_hyper_get_regions (size_t *num_regions, intn dim, size_t bound_count,
|
||||
printf("%s: check 2.0.5, lo_bounds[%d][%d].bound=%d\n",FUNC,
|
||||
(int)dim,(int)i,(int)lo_bounds[dim][i].bound);
|
||||
#endif /* QAK */
|
||||
|
||||
for (/*void*/;
|
||||
i<bound_count && pos[dim]>=lo_bounds[dim][i].bound+offset[dim];
|
||||
i++) {
|
||||
@ -1553,10 +1554,10 @@ H5S_hyper_add (H5S_t *space, const hssize_t *start, const hsize_t *size)
|
||||
#endif /* QAK */
|
||||
/* Increase size of boundary arrays for dataspace's selection */
|
||||
for(i=0; i<space->extent.u.simple.rank; i++) {
|
||||
#ifdef QAK
|
||||
printf("%s: check 3.1, i=%d\n",FUNC,(int)i);
|
||||
#endif /* QAK */
|
||||
tmp=space->select.sel_info.hyper.hyper_lst->lo_bounds[i];
|
||||
#ifdef QAK
|
||||
printf("%s: check 3.1, i=%d, space->sel_info.count=%d, tmp=%p\n",FUNC,(int)i, space->select.sel_info.hyper.hyper_lst->count,tmp);
|
||||
#endif /* QAK */
|
||||
if((space->select.sel_info.hyper.hyper_lst->lo_bounds[i]=H5MM_realloc(tmp,sizeof(H5S_hyper_bound_t)*(space->select.sel_info.hyper.hyper_lst->count+1)))==NULL) {
|
||||
space->select.sel_info.hyper.hyper_lst->lo_bounds[i]=tmp;
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
|
||||
@ -1765,18 +1766,15 @@ H5S_hyper_release (H5S_t *space)
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
hsize_t
|
||||
H5S_point_npoints (const H5S_t *space)
|
||||
H5S_hyper_npoints (const H5S_t *space)
|
||||
{
|
||||
FUNC_ENTER (H5S_point_npoints, 0);
|
||||
FUNC_ENTER (H5S_hyper_npoints, 0);
|
||||
|
||||
/* Check args */
|
||||
assert (space);
|
||||
|
||||
#ifdef QAK
|
||||
printf("%s: check 1.0, nelmts=%d\n",FUNC,(int)space->select.num_elem);
|
||||
#endif /* QAK */
|
||||
FUNC_LEAVE (space->select.num_elem);
|
||||
} /* H5S_point_npoints() */
|
||||
} /* H5S_hyper_npoints() */
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
|
@ -687,15 +687,18 @@ H5S_point_release (H5S_t *space)
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
hsize_t
|
||||
H5S_hyper_npoints (const H5S_t *space)
|
||||
H5S_point_npoints (const H5S_t *space)
|
||||
{
|
||||
FUNC_ENTER (H5S_hyper_npoints, 0);
|
||||
FUNC_ENTER (H5S_point_npoints, 0);
|
||||
|
||||
/* Check args */
|
||||
assert (space);
|
||||
|
||||
#ifdef QAK
|
||||
printf("%s: check 1.0, nelmts=%d\n",FUNC,(int)space->select.num_elem);
|
||||
#endif /* QAK */
|
||||
FUNC_LEAVE (space->select.num_elem);
|
||||
} /* H5S_hyper_npoints() */
|
||||
} /* H5S_point_npoints() */
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
|
@ -195,9 +195,13 @@ H5S_select_release (H5S_t *space)
|
||||
break;
|
||||
|
||||
case H5S_SEL_NONE: /* Nothing selected */
|
||||
default:
|
||||
break;
|
||||
} /* end switch() */
|
||||
|
||||
/* Reset type of selection to "all" */
|
||||
space->select.type=H5S_SEL_ALL;
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
} /* H5S_select_release() */
|
||||
|
||||
@ -287,19 +291,6 @@ H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op,
|
||||
block=(hsize_t *)_block;
|
||||
} /* end else */
|
||||
|
||||
/* Copy all the per-dimension selection info into the space descriptor */
|
||||
if((diminfo = H5MM_malloc(sizeof(H5S_hyper_dim_t)*space->extent.u.simple.rank))==NULL) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
|
||||
"can't allocate per-dimension vector");
|
||||
} /* end if */
|
||||
for(i=0; i<space->extent.u.simple.rank; i++) {
|
||||
diminfo[i].start = start[i];
|
||||
diminfo[i].stride = stride[i];
|
||||
diminfo[i].count = count[i];
|
||||
diminfo[i].block = block[i];
|
||||
} /* end for */
|
||||
space->select.sel_info.hyper.diminfo = diminfo;
|
||||
|
||||
/*
|
||||
* Check for overlapping blocks (remove when real block-merging algorithm
|
||||
* is in place).
|
||||
@ -335,6 +326,19 @@ H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op,
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
/* Copy all the per-dimension selection info into the space descriptor */
|
||||
if((diminfo = H5MM_malloc(sizeof(H5S_hyper_dim_t)*space->extent.u.simple.rank))==NULL) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
|
||||
"can't allocate per-dimension vector");
|
||||
} /* end if */
|
||||
for(i=0; i<space->extent.u.simple.rank; i++) {
|
||||
diminfo[i].start = start[i];
|
||||
diminfo[i].stride = stride[i];
|
||||
diminfo[i].count = count[i];
|
||||
diminfo[i].block = block[i];
|
||||
} /* end for */
|
||||
space->select.sel_info.hyper.diminfo = diminfo;
|
||||
|
||||
#ifdef QAK
|
||||
printf("%s: check 2.0\n",FUNC);
|
||||
#endif /* QAK */
|
||||
@ -671,6 +675,7 @@ H5S_select_npoints (const H5S_t *space)
|
||||
break;
|
||||
|
||||
case H5S_SEL_NONE: /* Nothing selected */
|
||||
default:
|
||||
ret_value=0;
|
||||
break;
|
||||
} /* end switch */
|
||||
@ -718,6 +723,7 @@ H5S_sel_iter_release (const H5S_t *space, H5S_sel_iter_t *sel_iter)
|
||||
break;
|
||||
|
||||
case H5S_SEL_NONE: /* Nothing selected */
|
||||
default:
|
||||
break;
|
||||
} /* end switch() */
|
||||
|
||||
@ -804,6 +810,7 @@ H5S_select_valid (const H5S_t *space)
|
||||
|
||||
case H5S_SEL_ALL: /* Entire extent selected */
|
||||
case H5S_SEL_NONE: /* Nothing selected */
|
||||
default:
|
||||
ret_value=TRUE;
|
||||
break;
|
||||
} /* end switch */
|
||||
|
Loading…
Reference in New Issue
Block a user