diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-11-08 15:32:53 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-11-08 15:32:53 (GMT) |
commit | 0497e80b5017f0292a3232cfec4e268f9776d137 (patch) | |
tree | adf245ba8f035a20cb91e688a2529e439674634c /src/H5FPserver.c | |
parent | dd969f1eadfd2cd500f3f44415b85cfea7216794 (diff) | |
download | hdf5-0497e80b5017f0292a3232cfec4e268f9776d137.zip hdf5-0497e80b5017f0292a3232cfec4e268f9776d137.tar.gz hdf5-0497e80b5017f0292a3232cfec4e268f9776d137.tar.bz2 |
[svn-r7829] Purpose:
Bug fix & code cleanup
Description:
Allowing the library to call malloc with a size of 0 bytes causes problems
for some users, so we check for allocations of 0 bytes and disallow them now.
Cleaned up some code which could call malloc with 0 size.
Changed some code calling HDmalloc directly to call H5MM_malloc(), which
allows us to check for 0 sized allocations.
Platforms tested:
FreeBSD 4.9 (sleipnir)
too minor to require h5committest
Diffstat (limited to 'src/H5FPserver.c')
-rw-r--r-- | src/H5FPserver.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/H5FPserver.c b/src/H5FPserver.c index 06ac060..55ae3b3 100644 --- a/src/H5FPserver.c +++ b/src/H5FPserver.c @@ -350,7 +350,7 @@ H5FP_new_object_lock(hobj_ref_t oid, unsigned rank, H5FP_obj_t obj_type, if (MPI_Comm_size(H5FP_SAP_COMM, &comm_size) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, NULL, "MPI_Comm_size failed"); - if ((ret_value = (H5FP_object_lock *)HDmalloc(sizeof(H5FP_object_lock))) == NULL) + if ((ret_value = (H5FP_object_lock *)H5MM_malloc(sizeof(H5FP_object_lock))) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "out of memory"); if ((ret_value->num_locks = (unsigned char *)HDcalloc(comm_size, 1)) == NULL) { @@ -505,7 +505,7 @@ H5FP_new_file_mod_node(unsigned UNUSED rank, H5FD_mem_t mem_type, FUNC_ENTER_NOINIT(H5FP_new_file_mod_node); - if ((ret_value = (H5FP_mdata_mod *)HDmalloc(sizeof(H5FP_mdata_mod))) == NULL) + if ((ret_value = (H5FP_mdata_mod *)H5MM_malloc(sizeof(H5FP_mdata_mod))) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "out of memory"); ret_value->mem_type = mem_type; @@ -624,7 +624,7 @@ H5FP_new_file_info_node(unsigned file_id) FUNC_ENTER_NOINIT(H5FP_new_file_info_node); - if ((ret_value = (H5FP_file_info *)HDmalloc(sizeof(H5FP_file_info))) == NULL) + if ((ret_value = (H5FP_file_info *)H5MM_malloc(sizeof(H5FP_file_info))) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "out of memory"); ret_value->file_id = file_id; @@ -965,7 +965,7 @@ H5FP_sap_handle_lock_request(H5FP_request_t *req) FUNC_ENTER_NOINIT(H5FP_sap_handle_lock_request); - if ((oids = (struct lock_group *)HDmalloc(list_size * + if ((oids = (struct lock_group *)H5MM_malloc(list_size * sizeof(struct lock_group))) == NULL) { exit_state = H5FP_STATUS_OOM; HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "out of memory"); @@ -1171,7 +1171,7 @@ H5FP_sap_handle_release_lock_request(H5FP_request_t *req) FUNC_ENTER_NOINIT(H5FP_sap_handle_release_lock_request); - if ((oids = (struct release_group *)HDmalloc(list_size * + if ((oids = (struct release_group *)H5MM_malloc(list_size * sizeof(struct release_group))) == NULL) { exit_state = H5FP_STATUS_OOM; HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "out of memory"); |