From fb8a48359b82934c6a2a33a0417a4c53bd54cee9 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 27 Mar 2024 18:17:52 -0700 Subject: [PATCH] Fix uninitialized memory issues in packet table --- hl/src/H5TB.c | 2 +- hl/test/test_table.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index e718605b5a3..82977b3253c 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -2025,7 +2025,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi goto out; /* alloc fill value attribute buffer */ - if (NULL == (tmp_fill_buf = (unsigned char *)malloc(total_size))) + if (NULL == (tmp_fill_buf = (unsigned char *)calloc(1, total_size))) goto out; /* get the fill value attributes */ diff --git a/hl/test/test_table.c b/hl/test/test_table.c index c6614343037..8996fa46480 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -376,6 +376,8 @@ test_table(hid_t fid, int do_write) field_type[3] = H5T_NATIVE_DOUBLE; field_type[4] = H5T_NATIVE_INT; + memset(wbufd, 0, NRECORDS * sizeof(particle_t)); + /*------------------------------------------------------------------------- * * Functions tested: