From 2a14d16d805762296e53ab25a6bc8b6a39230c11 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 25 Jul 2000 12:27:55 -0500 Subject: [svn-r2442] Insert better error checking when memory allocation fails (in certain obscure situations). --- src/H5FL.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/H5FL.c b/src/H5FL.c index 7fab4d0..e4dd7a4 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -370,7 +370,7 @@ H5FL_term(void) /* Terminating this layer never affects other layers; rather, other layers affect * the termination of this layer. */ return 0; -} +} /* end H5FL_term() */ /*------------------------------------------------------------------------- @@ -694,7 +694,8 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size) /* check if we are actually changing the size of the buffer */ if(new_size!=temp->size) { - ret_value=H5FL_blk_alloc(head,new_size,0); + if((ret_value=H5FL_blk_alloc(head,new_size,0))==NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block"); HDmemcpy(ret_value,block,MIN(new_size,temp->size)); H5FL_blk_free(head,block); } /* end if */ @@ -706,6 +707,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size) ret_value=H5FL_blk_alloc(head,new_size,0); #endif /* NO_BLK_FREE_LISTS */ +done: FUNC_LEAVE(ret_value); } /* end H5FL_blk_realloc() */ -- cgit v0.12