From d3e36b20b17f9891dc1874cd9a856a6b335465e1 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 16 Nov 2020 15:25:36 +0200 Subject: [PATCH] lib: data-stack - Use INITIAL_STACK_SIZE without growing it to nearest power --- src/lib/data-stack.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/data-stack.c b/src/lib/data-stack.c index 2cb3c8f8db..14e4022317 100644 --- a/src/lib/data-stack.c +++ b/src/lib/data-stack.c @@ -345,7 +345,9 @@ static struct stack_block *mem_block_alloc(size_t min_size) size_t prev_size, alloc_size; prev_size = current_block == NULL ? 0 : current_block->size; - alloc_size = nearest_power(MALLOC_ADD(prev_size, min_size)); + /* Use INITIAL_STACK_SIZE without growing it to nearest power. */ + alloc_size = prev_size == 0 ? min_size : + nearest_power(MALLOC_ADD(prev_size, min_size)); /* nearest_power() returns 2^n values, so alloc_size can't be anywhere close to SIZE_MAX */ -- 2.47.3