From: Alan T. DeKok Date: Fri, 30 Aug 2024 17:24:34 +0000 (-0400) Subject: compile_children() frees the group on error X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73bdec116d4b01369251d52ddf76810027d9bdbf;p=thirdparty%2Ffreeradius-server.git compile_children() frees the group on error --- diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index ce6c15c9a8..e22864b5e1 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -3265,6 +3265,7 @@ static unlang_t *compile_foreach(unlang_t *parent, unlang_compile_t *unlang_ctx, &t_rules); if (!vpt) { cf_canonicalize_error(cs, slen, "Failed parsing argument to 'foreach'", name2); + fail: talloc_free(g); return NULL; } @@ -3278,9 +3279,7 @@ static unlang_t *compile_foreach(unlang_t *parent, unlang_compile_t *unlang_ctx, if (!tmpl_is_attr(vpt)) { cf_log_err(cs, "MUST use attribute or list reference (not %s) in 'foreach'", tmpl_type_to_str(vpt->type)); - fail: - talloc_free(g); - return NULL; + goto fail; } if ((tmpl_attr_tail_num(vpt) != NUM_ALL) && (tmpl_attr_tail_num(vpt) != NUM_UNSPEC)) { @@ -3356,7 +3355,7 @@ static unlang_t *compile_foreach(unlang_t *parent, unlang_compile_t *unlang_ctx, fr_assert(gext->key != NULL); } - if (!compile_children(g, &unlang_ctx2, true)) goto fail; + if (!compile_children(g, &unlang_ctx2, true)) return NULL; return c; }