Skip to content

Commit 5ea2a31

Browse files
committed
it helps to parent things properly
1 parent 10899f3 commit 5ea2a31

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib/unlang/xlat_expr.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,7 @@ static fr_slen_t tokenize_unary(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuf
21672167
* See xlat_func_cast() for the implementation.
21682168
*
21692169
*/
2170-
static xlat_exp_t *expr_cast_alloc(TALLOC_CTX *ctx, fr_type_t type)
2170+
static xlat_exp_t *expr_cast_alloc(TALLOC_CTX *ctx, fr_type_t type, xlat_exp_t *child)
21712171
{
21722172
xlat_exp_t *cast, *node;
21732173

@@ -2198,6 +2198,8 @@ static xlat_exp_t *expr_cast_alloc(TALLOC_CTX *ctx, fr_type_t type)
21982198
node->data.vb_uint8 = type;
21992199

22002200
xlat_func_append_arg(cast, node, false);
2201+
(void) talloc_steal(cast, child);
2202+
xlat_func_append_arg(cast, child, false);
22012203

22022204
return cast;
22032205
}
@@ -2795,8 +2797,7 @@ static fr_slen_t tokenize_field(xlat_exp_head_t *head, xlat_exp_t **out, fr_sbuf
27952797
if (cast_type != FR_TYPE_NULL) {
27962798
xlat_exp_t *cast;
27972799

2798-
MEM(cast = expr_cast_alloc(head, cast_type));
2799-
xlat_func_append_arg(cast, node, false);
2800+
MEM(cast = expr_cast_alloc(head, cast_type, node));
28002801
node = cast;
28012802
}
28022803

0 commit comments

Comments
 (0)