From bc584494e625983f16f35982aa6dd6889e8dd222 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Thu, 25 Oct 2018 20:18:59 +0200 Subject: [PATCH] BUG/MINOR: cache: Wrong usage of shctx_init(). With this patch we check that shctx_init() does not returns 0. This is possible if the maxblocks argument, which is passed as an int, is negative due to an implicit conversion. Must be backported to 1.8. --- src/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache.c b/src/cache.c index 9070e996d..77986fb9e 100644 --- a/src/cache.c +++ b/src/cache.c @@ -925,7 +925,7 @@ int cfg_post_parse_section_cache() ret_shctx = shctx_init(&shctx, tmp_cache_config->maxblocks, CACHE_BLOCKSIZE, tmp_cache_config->maxobjsz, sizeof(struct cache), 1); - if (ret_shctx < 0) { + if (ret_shctx <= 0) { if (ret_shctx == SHCTX_E_INIT_LOCK) ha_alert("Unable to initialize the lock for the cache.\n"); else -- 2.47.3