summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-11-12 20:46:04 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-11-12 20:46:04 (GMT)
commit2d3c7c457e6f22a809af0f05344069acdcd92c8f (patch)
treeaa07e66aa5affdfa01a87fb0edbad6bd864accc3 /src/H5D.c
parenta89dda8cb1260f05f3e283ca80310b3090940341 (diff)
downloadhdf5-2d3c7c457e6f22a809af0f05344069acdcd92c8f.zip
hdf5-2d3c7c457e6f22a809af0f05344069acdcd92c8f.tar.gz
hdf5-2d3c7c457e6f22a809af0f05344069acdcd92c8f.tar.bz2
[svn-r7837] Purpose:
Bug fix. Description: Skip over situation where malloc(0) might occur. Platforms tested: IBM p690 (copper) too minor to require h5committest
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/H5D.c b/src/H5D.c
index bffa6b4..ecab019 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -3382,18 +3382,21 @@ H5D_flush(H5F_t *f, hid_t dxpl_id)
if((num_dsets=H5F_get_obj_count(f, H5F_OBJ_DATASET))<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset count");
- if(NULL==(id_list=H5MM_malloc(num_dsets*sizeof(hid_t))))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate memory for ID list");
- if(H5F_get_obj_ids(f, H5F_OBJ_DATASET, -1, id_list)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset ID list");
- for(j=0; j<num_dsets; j++) {
- if(NULL==(dataset=H5I_object_verify(id_list[j], H5I_DATASET)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset object");
- if(dataset->layout.type==H5D_COMPACT && dataset->layout.dirty)
- if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->layout), dxpl_id)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message");
- dataset->layout.dirty = FALSE;
- }
+ /* check for something to do */
+ if(num_dsets>0) {
+ if(NULL==(id_list=H5MM_malloc(num_dsets*sizeof(hid_t))))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate memory for ID list");
+ if(H5F_get_obj_ids(f, H5F_OBJ_DATASET, -1, id_list)<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset ID list");
+ for(j=0; j<num_dsets; j++) {
+ if(NULL==(dataset=H5I_object_verify(id_list[j], H5I_DATASET)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset object");
+ if(dataset->layout.type==H5D_COMPACT && dataset->layout.dirty)
+ if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->layout), dxpl_id)<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message");
+ dataset->layout.dirty = FALSE;
+ }
+ } /* end if */
done:
if(id_list!=NULL)