From 062c80c1acc83a5cc92fc1d0b5731670403dd1ee Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Tue, 30 Oct 2018 10:41:49 +0100 Subject: [PATCH] start enforcing a mininum number of elms in pools. --- src/pool.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pool.c b/src/pool.c index e415a0d..b21ea85 100644 --- a/src/pool.c +++ b/src/pool.c @@ -21,6 +21,8 @@ #include "kore.h" +#define POOL_MIN_ELEMENTS 16 + #define POOL_ELEMENT_BUSY 0 #define POOL_ELEMENT_FREE 1 @@ -38,6 +40,9 @@ kore_pool_init(struct kore_pool *pool, const char *name, { kore_debug("kore_pool_init(%p, %s, %zu, %zu)", pool, name, len, elm); + if (elm < POOL_MIN_ELEMENTS) + elm = POOL_MIN_ELEMENTS; + if ((pool->name = strdup(name)) == NULL) fatal("kore_pool_init: strdup %s", errno_s);