summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Tconv.c7
-rw-r--r--test/tvlstr.c2
2 files changed, 4 insertions, 5 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 534820b..3a94bb2 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -2838,13 +2838,12 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Check if conversion buffer is large enough, resize if
* necessary. If the SEQ_LEN is 0, allocate a minimal size buffer. */
- if(src_size==0 && dst_size==0) {
+ if(!seq_len && !conv_buf) {
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)
+ if((conv_buf=H5FL_BLK_MALLOC(vlen_seq,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)) {
+ else 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;
if((conv_buf=H5FL_BLK_REALLOC(vlen_seq,conv_buf, conv_buf_size))==NULL)
diff --git a/test/tvlstr.c b/test/tvlstr.c
index a7b2a32..e41da26 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -256,7 +256,7 @@ test_vlstrings_basic(void)
static void
test_vlstrings_special(void)
{
- const char *wdata[SPACE1_DIM1] = {"one", "two", "", "\0"};
+ const char *wdata[SPACE1_DIM1] = {"", "two", "three", "\0"};
const char *wdata2[SPACE1_DIM1] = {NULL, NULL, NULL, NULL};
char *rdata[SPACE1_DIM1]; /* Information read in */
char *fill; /* Fill value */