summaryrefslogtreecommitdiffstats
path: root/src/H5Tconv.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2007-03-26 18:55:36 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2007-03-26 18:55:36 (GMT)
commit4eed634bcf57fc1253f77bea2256d407db098d51 (patch)
treef80a785164f1ecdc39aa16e9c3554eef259953a3 /src/H5Tconv.c
parent00f32db756d2f11f9fddb8edc67850944aa5ee1d (diff)
downloadhdf5-4eed634bcf57fc1253f77bea2256d407db098d51.zip
hdf5-4eed634bcf57fc1253f77bea2256d407db098d51.tar.gz
hdf5-4eed634bcf57fc1253f77bea2256d407db098d51.tar.bz2
[svn-r13542] Added a detection for zero-length VL data in H5T_conv_vlen to handle the case properly. This fix
was discovered by the user while Bug #717 was being fixed. Modefied the test, too.
Diffstat (limited to 'src/H5Tconv.c')
-rw-r--r--src/H5Tconv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index f151a1a..534820b 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2837,7 +2837,13 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
dst_size=seq_len*dst_base_size;
/* Check if conversion buffer is large enough, resize if
- * necessary */
+ * necessary. If the SEQ_LEN is 0, allocate a minimal size buffer. */
+ if(src_size==0 && dst_size==0) {
+ conv_buf_size=((1/H5T_VLEN_MIN_CONF_BUF_SIZE)+1)*H5T_VLEN_MIN_CONF_BUF_SIZE;
+ if((conv_buf=H5FL_BLK_REALLOC(vlen_seq,conv_buf, conv_buf_size))==NULL)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ }
+
if(conv_buf_size<MAX(src_size,dst_size)) {
/* Only allocate conversion buffer in H5T_VLEN_MIN_CONF_BUF_SIZE increments */
conv_buf_size=((MAX(src_size,dst_size)/H5T_VLEN_MIN_CONF_BUF_SIZE)+1)*H5T_VLEN_MIN_CONF_BUF_SIZE;