From 9c4f08ae3915fe325d9d40f269652b88bfdefe03 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Fri, 1 Feb 2019 16:28:04 +0100 Subject: [PATCH] BUG/MINOR: tune.fail-alloc: Don't forget to initialize ret. In mem_should_fail(), if we don't want to fail the allocation, either because mem_fail_rate is 0, or because we're still initializing, don't forget to initialize ret, or we may return a non-zero value, and fail an allocation we didn't want to fail. This should only affect users that compile with DEBUG_FAIL_ALLOC. --- src/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/memory.c b/src/memory.c index 04259a539..b200c3804 100644 --- a/src/memory.c +++ b/src/memory.c @@ -581,7 +581,7 @@ __decl_hathreads(static HA_SPINLOCK_T mem_fail_lock); int mem_should_fail(const struct pool_head *pool) { - int ret; + int ret = 0; int n; if (mem_fail_rate > 0 && !(global.mode & MODE_STARTING)) {