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/H5HL.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/H5HL.c')
-rw-r--r-- | src/H5HL.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -141,7 +141,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/) heap->addr = *addr_p + (hsize_t)H5HL_SIZEOF_HDR(f); heap->disk_alloc = size_hint; heap->mem_alloc = size_hint; - if (NULL==(heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(hsize_t)(H5HL_SIZEOF_HDR(f) + size_hint),1))) { + if (NULL==(heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(H5HL_SIZEOF_HDR(f) + size_hint),1))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } @@ -253,7 +253,7 @@ H5HL_load(H5F_t *f, haddr_t addr, const void UNUSED *udata1, /* data */ H5F_addr_decode(f, &p, &(heap->addr)); - heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(hsize_t)(H5HL_SIZEOF_HDR(f) + heap->mem_alloc),1); + heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(H5HL_SIZEOF_HDR(f) + heap->mem_alloc),1); if (NULL==heap->chunk) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); |