From: Arran Cudbard-Bell Date: Wed, 1 Nov 2023 22:35:22 +0000 (-0600) Subject: xlat: Don't leave dangling marker X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c372a3f53a9f0cd5edb7750ed9d58d234f80f97;p=thirdparty%2Ffreeradius-server.git xlat: Don't leave dangling marker --- diff --git a/src/lib/unlang/xlat_tokenize.c b/src/lib/unlang/xlat_tokenize.c index 6d1d76fc59f..38ec2fbc4b9 100644 --- a/src/lib/unlang/xlat_tokenize.c +++ b/src/lib/unlang/xlat_tokenize.c @@ -1186,6 +1186,7 @@ static int xlat_tokenize_input(xlat_exp_head_t *head, fr_sbuff_t *in, * Free our temporary array of terminals */ if (tokens != &terminals) talloc_free(tokens); + fr_sbuff_marker_release(&m_s); return -1; } @@ -1211,9 +1212,11 @@ static int xlat_tokenize_input(xlat_exp_head_t *head, fr_sbuff_t *in, xlat_exp_insert_tail(head, node); node = NULL; + fr_sbuff_marker_release(&m_s); continue; } + /* * We have parsed as much as we can as unescaped * input. Either some text (and added the node @@ -1227,6 +1230,8 @@ static int xlat_tokenize_input(xlat_exp_head_t *head, fr_sbuff_t *in, if (fr_sbuff_adv_past_str_literal(in, "%{")) { TALLOC_FREE(node); /* nope, couldn't use it */ if (xlat_tokenize_expansion(head, in, t_rules) < 0) goto error; + next: + fr_sbuff_marker_release(&m_s); continue; } @@ -1236,7 +1241,7 @@ static int xlat_tokenize_input(xlat_exp_head_t *head, fr_sbuff_t *in, if (fr_sbuff_adv_past_str_literal(in, "%(")) { TALLOC_FREE(node); /* nope, couldn't use it */ if (xlat_tokenize_function_args(head, in, t_rules) < 0) goto error; - continue; + goto next; } /* @@ -1259,7 +1264,7 @@ static int xlat_tokenize_input(xlat_exp_head_t *head, fr_sbuff_t *in, * Tokenize the function arguments using the new method. */ if (xlat_tokenize_function_new(head, in, t_rules) < 0) goto error; - continue; + goto next; } /* @@ -1267,6 +1272,7 @@ static int xlat_tokenize_input(xlat_exp_head_t *head, fr_sbuff_t *in, */ TALLOC_FREE(node); XLAT_DEBUG("VALUE-BOX <-- (empty)"); + fr_sbuff_marker_release(&m_s); break; }