]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
compile_children() frees the group on error
authorAlan T. DeKok <aland@freeradius.org>
Fri, 30 Aug 2024 17:24:34 +0000 (13:24 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 30 Aug 2024 17:24:34 +0000 (13:24 -0400)
src/lib/unlang/compile.c

index ce6c15c9a8cca8141bdb7c127fc77d9d4108c664..e22864b5e1f3d61b3183d85a5f34e79b2505ff68 100644 (file)
@@ -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;
 }