summaryrefslogtreecommitdiffstats
path: root/src/H5HG.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-06-21 16:53:39 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-06-21 16:53:39 (GMT)
commit4402923400e705eac6d28f97518bf18c536f6c80 (patch)
treed6e4254a561072885795c0f7881ccddbbfd79895 /src/H5HG.c
parent8263f168f703f8a680a49419a0053c384abec4c3 (diff)
downloadhdf5-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/H5HG.c')
-rw-r--r--src/H5HG.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/H5HG.c b/src/H5HG.c
index a51632d..4914fe0 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -137,12 +137,12 @@ printf("%s: size=%d\n",FUNC,(int)size);
heap->addr = addr;
heap->size = size;
heap->dirty = TRUE;
- if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,(hsize_t)size,0))) {
+ if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,size,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
heap->nalloc = H5HG_NOBJS (f, size);
- if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,(hsize_t)heap->nalloc,1))) {
+ if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,heap->nalloc,1))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@@ -253,7 +253,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1,
"memory allocation failed");
}
heap->addr = addr;
- if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,(hsize_t)H5HG_MINSIZE,0))) {
+ if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,H5HG_MINSIZE,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@@ -289,7 +289,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1,
*/
if (heap->size > H5HG_MINSIZE) {
haddr_t next_addr = addr + (hsize_t)H5HG_MINSIZE;
- if (NULL==(heap->chunk = H5FL_BLK_REALLOC (heap_chunk, heap->chunk, (hsize_t)heap->size))) {
+ if (NULL==(heap->chunk = H5FL_BLK_REALLOC (heap_chunk, heap->chunk, heap->size))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@@ -303,7 +303,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1,
/* Decode each object */
p = heap->chunk + H5HG_SIZEOF_HDR (f);
nalloc = H5HG_NOBJS (f, heap->size);
- if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,(hsize_t)nalloc,1))) {
+ if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,nalloc,1))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}