]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
check for debug BEFORE calling debug function
authorAlan T. DeKok <aland@freeradius.org>
Mon, 9 Dec 2019 02:06:29 +0000 (21:06 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 9 Dec 2019 13:30:43 +0000 (08:30 -0500)
map_list_mod_debug() does a lot of unconditional allocations.
So don't call it unless we know it's debugging

src/lib/server/map.c

index 2ba8c512216455d5b7ef4b63ae4e4dd49e1a105c..795511e84f056da7b29898e0a230c86de1d31b91 100644 (file)
@@ -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 */