diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-06-21 16:53:39 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-06-21 16:53:39 (GMT) |
commit | 4402923400e705eac6d28f97518bf18c536f6c80 (patch) | |
tree | d6e4254a561072885795c0f7881ccddbbfd79895 /src/H5AC.c | |
parent | 8263f168f703f8a680a49419a0053c384abec4c3 (diff) | |
download | hdf5-4402923400e705eac6d28f97518bf18c536f6c80.zip hdf5-4402923400e705eac6d28f97518bf18c536f6c80.tar.gz hdf5-4402923400e705eac6d28f97518bf18c536f6c80.tar.bz2 |
[svn-r4038] Purpose:
Code clean/bug fix
Description:
H5FL (free-list manager) code currently is taking an hsize_t as the size
of a memory block to allocate. On many machines, the size of an hsize_t
is greater than the size of a size_t, potentially leading to incorrect
memory allocations in rare circumstances.
Solution:
Changed hsize_t parameters and variables to size_t.
Platforms tested:
FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'src/H5AC.c')
-rw-r--r-- | src/H5AC.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -100,13 +100,13 @@ H5AC_create(H5F_t *f, intn size_hint) "memory allocation failed"); } cache->nslots = size_hint; - cache->slot = H5FL_ARR_ALLOC(H5AC_info_ptr_t,(hsize_t)cache->nslots,1); + cache->slot = H5FL_ARR_ALLOC(H5AC_info_ptr_t,cache->nslots,1); if (NULL==cache->slot) { f->shared->cache = H5FL_FREE (H5AC_t,f->shared->cache); HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } #ifdef H5AC_DEBUG - if ((cache->prot = H5FL_ARR_ALLOC(H5AC_prot_t,(hsize_t)cache->nslots,1))==NULL) { + if ((cache->prot = H5FL_ARR_ALLOC(H5AC_prot_t,cache->nslots,1))==NULL) { cache->slot = H5FL_ARR_FREE (H5AC_info_ptr_t,cache->slot); f->shared->cache = H5FL_FREE (H5AC_t,f->shared->cache); HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); @@ -414,7 +414,7 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr, hbool_t destroy) * Sort the cache entries by address since flushing them in * ascending order by address may be much more efficient. */ - if (NULL==(map=H5FL_ARR_ALLOC(intn,(hsize_t)cache->nslots,0))) { + if (NULL==(map=H5FL_ARR_ALLOC(intn,cache->nslots,0))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } |