From: Matthijs Mekking Date: Tue, 4 Feb 2020 14:52:56 +0000 (+0100) Subject: more_frags: check for basic blocks != NULL X-Git-Tag: v9.14.11~20^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6799f2208f9c4048d15fdfe5ace38123f8cdfb7f;p=thirdparty%2Fbind9.git more_frags: check for basic blocks != NULL --- diff --git a/lib/isc/mem.c b/lib/isc/mem.c index b26d0fa653f..ad3af97e960 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -342,7 +342,7 @@ quantize(size_t size) { return ((size + ALIGNMENT_SIZE - 1) & (~(ALIGNMENT_SIZE - 1))); } -static inline bool +static inline void more_basic_blocks(isc__mem_t *ctx) { void *tmp; unsigned char *curr, *next; @@ -351,6 +351,11 @@ more_basic_blocks(isc__mem_t *ctx) { unsigned int table_size; int i; + if (ctx->basic_blocks != NULL) { + /* Nothing to do. */ + return; + } + /* Require: we hold the context lock. */ INSIST(ctx->basic_table_count <= ctx->basic_table_size); @@ -400,8 +405,6 @@ more_basic_blocks(isc__mem_t *ctx) { if (last > ctx->highest) ctx->highest = last; ctx->basic_blocks = tmp; - - return (true); } static inline bool @@ -415,17 +418,16 @@ more_frags(isc__mem_t *ctx, size_t new_size) { * Try to get more fragments by chopping up a basic block. */ + more_basic_blocks(ctx); if (ctx->basic_blocks == NULL) { - if (!more_basic_blocks(ctx)) { - /* - * We can't get more memory from the OS, or we've - * hit the quota for this context. - */ - /* - * XXXRTH "At quota" notification here. - */ - return (false); - } + /* + * We can't get more memory from the OS, or we've + * hit the quota for this context. + */ + /* + * XXXRTH "At quota" notification here. + */ + return (false); } total_size = ctx->mem_target;