From 1b23b0e8c1416f4b15eb92b5f3fab83bef0e17cf Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Mon, 5 Mar 2007 16:44:55 -0500 Subject: [svn-r13459] Fix for Bug #763 - failure to create dataset of variable-length data with fill value. In function H5O_fill_convert, the background buffer was allocated without clearing. Later in H5T_vlen_disk_write , library thought there's data in this background buffer. Changed the allocating function to CALLOC. --- src/H5Ofill.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 1914e0a..b999648 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -811,7 +811,10 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed, hid_ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") HDmemcpy(buf, fill->buf, H5T_get_size(fill->type)); } /* end else */ - if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(dset_type)))) + + /* Use CALLOC here to clear the buffer in case later the library thinks there's + * data in the background. */ + if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(dset_type)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") /* Do the conversion */ -- cgit v0.12