]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
xlat: Don't leave dangling marker
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 1 Nov 2023 22:35:22 +0000 (16:35 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 1 Nov 2023 22:35:22 +0000 (16:35 -0600)
src/lib/unlang/xlat_tokenize.c

index 6d1d76fc59f3e43bef6f98c3b1a741b3bcf3dade..38ec2fbc4b9a4c4af78303e6a7e5addcddc4ad09 100644 (file)
@@ -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;
        }