summaryrefslogtreecommitdiffstats
path: root/src/H5Dio.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2012-03-27 17:03:32 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2012-03-27 17:03:32 (GMT)
commit6234c0dee27daa5450d140fc9189135ac2ae0fa8 (patch)
tree1a869c17dadebf13e3f95f0cfe89aec1c4bf324d /src/H5Dio.c
parentbf4f44388bf8c3fcb27db1c69a14dc49b25bce86 (diff)
downloadhdf5-6234c0dee27daa5450d140fc9189135ac2ae0fa8.zip
hdf5-6234c0dee27daa5450d140fc9189135ac2ae0fa8.tar.gz
hdf5-6234c0dee27daa5450d140fc9189135ac2ae0fa8.tar.bz2
[svn-r22156] Issue 7785 - Writing or reading many small chunks ran out of memory and caused seg fault. I added checks in two places to make sure the library returns error stack
when it fails to allocate memory. I didn't add any test to the test suite since there is no good way to test it. But I tested and verified the error stack by hand. Tested on jam - this is a merge from the trunk.
Diffstat (limited to 'src/H5Dio.c')
-rw-r--r--src/H5Dio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 9fece3a..2c0c2e0 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -433,6 +433,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
|| dataset->shared->layout.type == H5D_COMPACT);
/* Call storage method's I/O initialization routine */
+ HDmemset(&fm, 0, sizeof(H5D_chunk_map_t));
if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info")
io_op_init = TRUE;
@@ -656,6 +657,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
#endif /*H5_HAVE_PARALLEL*/
/* Call storage method's I/O initialization routine */
+ HDmemset(&fm, 0, sizeof(H5D_chunk_map_t));
if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info")
io_op_init = TRUE;