diff options
author | vchoi <vchoi@jelly.ad.hdfgroup.org> | 2021-08-17 17:01:39 (GMT) |
---|---|---|
committer | vchoi <vchoi@jelly.ad.hdfgroup.org> | 2021-08-17 17:01:39 (GMT) |
commit | b815aecb857966c2c4eb88e77a5da8f2bbc2a46a (patch) | |
tree | 79c4baa1ee58cd840d7319ca0d3e902be95196fa /test/vfd_swmr_attrdset_writer.c | |
parent | 0a4ee8910a507f0aeb4db21e509b1569c9056b3d (diff) | |
download | hdf5-b815aecb857966c2c4eb88e77a5da8f2bbc2a46a.zip hdf5-b815aecb857966c2c4eb88e77a5da8f2bbc2a46a.tar.gz hdf5-b815aecb857966c2c4eb88e77a5da8f2bbc2a46a.tar.bz2 |
Modifications as indicated by valgrind --tool=memcheck for the following files:
(1) test/vfd_swmr_attrdset_writer.c
Free memory for variable length string + cleanup
(2) test/vfd_swmr_bigset_writer.c
Free memory for s.dataset and s.sources
(3) test/vfd_swmr_vlstr_reader.c
Free memory for content[]
Also fix a bug in test/testvfdswmr.sh.in so that os_groups_seg test will only be executed when specified.
Diffstat (limited to 'test/vfd_swmr_attrdset_writer.c')
-rw-r--r-- | test/vfd_swmr_attrdset_writer.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/test/vfd_swmr_attrdset_writer.c b/test/vfd_swmr_attrdset_writer.c index 67eeb2c..8eeadaf 100644 --- a/test/vfd_swmr_attrdset_writer.c +++ b/test/vfd_swmr_attrdset_writer.c @@ -924,7 +924,6 @@ perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *c unsigned step; bool result; unsigned dd; - bool ret = true; for (step = 0; step < s->asteps; step++) { dbgf(2, "Adding attribute %d\n", step); @@ -1507,7 +1506,7 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned unsigned int read_which; unsigned int tmp_val; char tmp_vl_val[sizeof("attr-9999999999")]; - char * read_vl_which = NULL; + char * read_vl_which; bool is_vl = false; hid_t aid = H5I_INVALID_HID; hid_t atid = H5I_INVALID_HID; @@ -1531,11 +1530,6 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned HDsprintf(tmp_vl_val, "%u", which); else HDsprintf(tmp_vl_val, "%u %c", which, 'M'); - - if ((read_vl_which = HDmalloc(sizeof("9999999999"))) == NULL) { - HDprintf("HDmalloc failed\n"); - TEST_ERROR; - } } else { if (action == MODIFY_ATTR) @@ -1544,7 +1538,7 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned tmp_val = which; } - if (H5Aread(aid, atid, is_vl ? (void *)&read_vl_which : (void *)&read_which) < 0) { + if (H5Aread(aid, atid, is_vl ? &read_vl_which : (void *)&read_which) < 0) { HDprintf("H5Aread failed\n"); TEST_ERROR; } @@ -1569,8 +1563,8 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned ret = (read_which == tmp_val); } - if (read_vl_which) - HDfree(read_vl_which); + if (is_vl) + H5free_memory(read_vl_which); return ret; @@ -1582,8 +1576,8 @@ error: } H5E_END_TRY; - if (read_vl_which) - HDfree(read_vl_which); + if (is_vl) + H5free_memory(read_vl_which); return false; @@ -1962,15 +1956,12 @@ main(int argc, char **argv) { hid_t fapl = H5I_INVALID_HID; hid_t fcpl = H5I_INVALID_HID; - unsigned step; bool writer = FALSE; state_t s; const char * personality; H5F_vfd_swmr_config_t config; np_state_t np; dsets_state_t ds; - unsigned dd; - bool result; if (!state_init(&s, argc, argv)) { HDprintf("state_init() failed\n"); |