diff --git a/libs/libks/src/ks_hash.c b/libs/libks/src/ks_hash.c index db26209419..c65e2b4d28 100644 --- a/libs/libks/src/ks_hash.c +++ b/libs/libks/src/ks_hash.c @@ -558,7 +558,9 @@ ks_hash_destroy(ks_hash_t **h) ks_pool_safe_free(pool, (*h)->table); ks_hash_write_unlock(*h); if ((*h)->rwl) ks_pool_free(pool, (*h)->rwl); - ks_pool_free(pool, (*h)->mutex); + if ((*h)->mutex) { + ks_pool_free(pool, (*h)->mutex); + } ks_pool_free(pool, *h); pool = NULL; *h = NULL; diff --git a/libs/libks/test/testhash.c b/libs/libks/test/testhash.c index 220a6c6959..7b7bdc24e2 100644 --- a/libs/libks/test/testhash.c +++ b/libs/libks/test/testhash.c @@ -132,7 +132,7 @@ int test3(void) char *A, *B, *C; ks_pool_open(&pool); - ks_hash_create(&hash, KS_HASH_MODE_ARBITRARY, KS_HASH_FLAG_NONE, pool); + ks_hash_create(&hash, KS_HASH_MODE_ARBITRARY, KS_HASH_FLAG_NOLOCK, pool); ks_hash_set_keysize(hash, TEST3_SIZE); randombytes_buf(data, sizeof(data));