From: Alan T. DeKok Date: Mon, 9 Dec 2019 02:06:29 +0000 (-0500) Subject: check for debug BEFORE calling debug function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=129aec4b266d64e5e7e6a31447a0331b57011023;p=thirdparty%2Ffreeradius-server.git check for debug BEFORE calling debug function map_list_mod_debug() does a lot of unconditional allocations. So don't call it unless we know it's debugging --- diff --git a/src/lib/server/map.c b/src/lib/server/map.c index 2ba8c512216..795511e84f0 100644 --- a/src/lib/server/map.c +++ b/src/lib/server/map.c @@ -1774,9 +1774,16 @@ int map_list_mod_apply(REQUEST *request, vp_list_mod_t const *vlm) rad_assert(((mod->op == T_OP_CMP_FALSE) && tmpl_is_null(mod->rhs)) || tmpl_is_data(mod->rhs)); - for (vb = &mod->rhs->tmpl_value; - vb; - vb = vb->next) map_list_mod_debug(request, map, mod, vb->type != FR_TYPE_INVALID ? vb : NULL); + /* + * map_list_mod_debug() + */ + if (RDEBUG_ENABLED2) { + for (vb = &mod->rhs->tmpl_value; + vb; + vb = vb->next) { + map_list_mod_debug(request, map, mod, vb->type != FR_TYPE_INVALID ? vb : NULL); + } + } } mod = vlm->mod; /* Reset */