rsys

Basic data structures and low-level features
git clone git://git.meso-star.fr/rsys.git
Log | Files | Refs | README | LICENSE

commit 959c8dd6c600c1654c452edebfef9fc5db111454
parent 09afde0d43483be679abb8dbc72fc4c5293cec7d
Author: vaplv <vaplv@free.fr>
Date:   Thu, 10 May 2018 10:17:08 +0200

Fix a possible used of uninitialized memory in htable_reserve

Diffstat:
Msrc/hash_table.h | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/hash_table.h b/src/hash_table.h @@ -351,11 +351,12 @@ HTABLE_FUNC__(reserve)(struct HTABLE__* htbl, const size_t size_submitted) if(size <= HTABLE_DATA_FUNC__(size_get)(&htbl->table)) goto exit; + darray_char_init(htbl->allocator, &tbl_slot_is_used); + HTABLE_DATA_FUNC__(init)(htbl->allocator, &tbl); if(RES_OK != (res = HTABLE_DATA_FUNC__(resize)(&tbl, size))) goto error; - darray_char_init(htbl->allocator, &tbl_slot_is_used); if(RES_OK != (res = darray_char_resize(&tbl_slot_is_used, size))) goto error; memset(darray_char_data_get(&tbl_slot_is_used), 0, size*sizeof(char));