diff --git a/include/haproxy/pool-t.h b/include/haproxy/pool-t.h index 4b185ef9a..073fe3251 100644 --- a/include/haproxy/pool-t.h +++ b/include/haproxy/pool-t.h @@ -46,7 +46,7 @@ * case we disable global pools. The global pools may still be enforced * using CONFIG_HAP_GLOBAL_POOLS though. */ -#if defined(USE_THREAD) && defined(HA_HAVE_FAST_MALLOC) && defined(CONFIG_HAP_POOLS) && !defined(CONFIG_HAP_GLOBAL_POOLS) +#if defined(USE_THREAD) && defined(HA_HAVE_FAST_MALLOC) && !defined(CONFIG_HAP_GLOBAL_POOLS) #define CONFIG_HAP_NO_GLOBAL_POOLS #endif diff --git a/src/pool.c b/src/pool.c index b493a933e..59cc5083e 100644 --- a/src/pool.c +++ b/src/pool.c @@ -156,6 +156,10 @@ void *__pool_refill_alloc(struct pool_head *pool, unsigned int avail) int limit = pool->limit; void *ptr = NULL; +#ifdef DEBUG_FAIL_ALLOC + if (mem_should_fail(pool)) + return NULL; +#endif if (limit && allocated >= limit) { activity[tid].pool_fail++; return NULL; @@ -218,6 +222,10 @@ void *__pool_refill_alloc(struct pool_head *pool, unsigned int avail) int limit = pool->limit; int allocated = pool->allocated, allocated_orig = allocated; +#ifdef DEBUG_FAIL_ALLOC + if (mem_should_fail(pool)) + return NULL; +#endif /* stop point */ avail += pool->used;