diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2022-05-05 20:32:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 20:32:49 (GMT) |
commit | cdf837d0a16acd657e53057d19b4b21763eeca45 (patch) | |
tree | ff1620fa02003742a02bcbb3caf88e1c1789a975 /src | |
parent | c4cd250408c7f973c909a56c3cae18ed6a0118f2 (diff) | |
download | hdf5-cdf837d0a16acd657e53057d19b4b21763eeca45.zip hdf5-cdf837d0a16acd657e53057d19b4b21763eeca45.tar.gz hdf5-cdf837d0a16acd657e53057d19b4b21763eeca45.tar.bz2 |
Fix a few Clang sanitizer warnings (#1727)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Tconv.c | 28 | ||||
-rw-r--r-- | src/H5VLdyn_ops.c | 7 |
2 files changed, 23 insertions, 12 deletions
diff --git a/src/H5Tconv.c b/src/H5Tconv.c index da98182..de836dc 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3266,9 +3266,10 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* If we're down to the last few elements, just wrap up */ /* with a "real" reverse copy */ if (safe < 2) { - s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; - d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; - b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; + s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; + d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; + if (bkg) + b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; s_stride = -s_stride; d_stride = -d_stride; b_stride = -b_stride; @@ -3278,7 +3279,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si else { s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride; d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride; - b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; + if (bkg) + b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; } /* end else */ } /* end if */ else { @@ -3426,7 +3428,9 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* Advance pointers */ s += s_stride; d += d_stride; - b += b_stride; + + if (b) + b += b_stride; } /* end for */ /* Decrement number of elements left to convert */ @@ -3716,9 +3720,10 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* If we're down to the last few elements, just wrap up */ /* with a "real" reverse copy */ if (safe < 2) { - s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; - d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; - b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; + s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride; + d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride; + if (bkg) + b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride; s_stride = -s_stride; d_stride = -d_stride; b_stride = -b_stride; @@ -3728,7 +3733,8 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz else { s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride; d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride; - b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; + if (bkg) + b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride; } /* end else */ } /* end if */ else { @@ -3796,7 +3802,9 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Advance pointers */ s += s_stride; d += d_stride; - b += b_stride; + + if (b) + b += b_stride; } /* end for */ /* Decrement number of elements left to convert */ diff --git a/src/H5VLdyn_ops.c b/src/H5VLdyn_ops.c index e175246..7889224 100644 --- a/src/H5VLdyn_ops.c +++ b/src/H5VLdyn_ops.c @@ -166,9 +166,12 @@ H5VL__term_opt_operation(void) FUNC_ENTER_PACKAGE_NOERR /* Iterate over the VOL subclasses */ - for (subcls = 0; subcls < NELMTS(H5VL_opt_vals_g); subcls++) - if (H5VL_opt_ops_g[subcls]) + for (subcls = 0; subcls < NELMTS(H5VL_opt_vals_g); subcls++) { + if (H5VL_opt_ops_g[subcls]) { H5SL_destroy(H5VL_opt_ops_g[subcls], H5VL__term_opt_operation_cb, NULL); + H5VL_opt_ops_g[subcls] = NULL; + } + } FUNC_LEAVE_NOAPI(SUCCEED) } /* H5VL__term_opt_operation() */ |