From: Olivier Houchard Date: Fri, 1 Feb 2019 15:28:04 +0000 (+0100) Subject: BUG/MINOR: tune.fail-alloc: Don't forget to initialize ret. X-Git-Tag: v2.0-dev1~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9c4f08ae3915fe325d9d40f269652b88bfdefe03;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/memory.c b/src/memory.c index 04259a5390..b200c38048 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)) {