diff options
Diffstat (limited to 'test/vds_env.c')
-rw-r--r-- | test/vds_env.c | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/test/vds_env.c b/test/vds_env.c index 58d90fc..959fc94 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -44,13 +44,13 @@ const char *FILENAME[] = {"vds_env_virt_0", "vds_env_virt_3", "vds_env_src_2", " static int test_vds_prefix_second(unsigned config, hid_t fapl) { - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - char vfilename2[FILENAME_BUF_SIZE]; - char srcfilenamepct[FILENAME_BUF_SIZE]; - char srcfilenamepct_map[FILENAME_BUF_SIZE]; const char *srcfilenamepct_map_orig = "vds%%%%_src"; + char * srcfilename = NULL; + char * srcfilename_map = NULL; + char * vfilename = NULL; + char * vfilename2 = NULL; + char * srcfilenamepct = NULL; + char * srcfilenamepct_map = NULL; hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ hid_t vfile = -1; /* File with virtual dset */ hid_t dcpl = -1; /* Dataset creation property list */ @@ -69,12 +69,25 @@ test_vds_prefix_second(unsigned config, hid_t fapl) TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix") - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2); - h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[3], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + if (NULL == (srcfilename = HDmalloc(FILENAME_BUF_SIZE))) + TEST_ERROR + if (NULL == (srcfilename_map = HDmalloc(FILENAME_BUF_SIZE))) + TEST_ERROR + if (NULL == (vfilename = HDmalloc(FILENAME_BUF_SIZE))) + TEST_ERROR + if (NULL == (vfilename2 = HDmalloc(FILENAME_BUF_SIZE))) + TEST_ERROR + if (NULL == (srcfilenamepct = HDmalloc(FILENAME_BUF_SIZE))) + TEST_ERROR + if (NULL == (srcfilenamepct_map = HDmalloc(FILENAME_BUF_SIZE))) + TEST_ERROR + + h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[1], fapl, vfilename2, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[2], fapl, srcfilename, FILENAME_BUF_SIZE); + h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, FILENAME_BUF_SIZE); + h5_fixname(FILENAME[3], fapl, srcfilenamepct, FILENAME_BUF_SIZE); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE); /* create tmp directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) @@ -260,10 +273,24 @@ test_vds_prefix_second(unsigned config, hid_t fapl) TEST_ERROR dcpl = -1; + HDfree(srcfilenamepct_map); + HDfree(srcfilenamepct); + HDfree(vfilename2); + HDfree(vfilename); + HDfree(srcfilename_map); + HDfree(srcfilename); + PASSED(); return 0; error: + HDfree(srcfilenamepct_map); + HDfree(srcfilenamepct); + HDfree(vfilename2); + HDfree(vfilename); + HDfree(srcfilename_map); + HDfree(srcfilename); + H5E_BEGIN_TRY { for (i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) |