From 68e5321da096a4a3cd0650d4e694f97abcc5722a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 15 Dec 2016 18:59:53 -0600 Subject: [PATCH] regression from nolock mode --- libs/libks/src/ks_hash.c | 4 +++- libs/libks/test/testhash.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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));