From 62c73d8b41ee01afb7a68f08247e91e9c33822bc Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 10 Apr 2019 07:40:29 -0400 Subject: [PATCH] harden thread_arena check --- h_malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/h_malloc.c b/h_malloc.c index ce25599..5142b8a 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -469,7 +469,7 @@ static inline void *allocate_small(size_t requested_size) { size_t size = info.size ? info.size : 16; #if N_ARENA > 1 - if (unlikely(thread_arena == N_ARENA)) { + if (unlikely(thread_arena >= N_ARENA)) { thread_arena = thread_arena_counter++ % N_ARENA; } #endif