From: Alan T. DeKok Date: Tue, 24 May 2022 18:21:07 +0000 (-0400) Subject: check fields only when they're valid X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a918361145f68ec307b2e7c3ba6e90a0f973501e;p=thirdparty%2Ffreeradius-server.git check fields only when they're valid --- diff --git a/src/lib/unlang/xlat_inst.c b/src/lib/unlang/xlat_inst.c index 3fff1b2c55b..816a2724f27 100644 --- a/src/lib/unlang/xlat_inst.c +++ b/src/lib/unlang/xlat_inst.c @@ -260,8 +260,8 @@ static xlat_inst_t *xlat_inst_alloc(xlat_exp_t *node) */ static int _xlat_instantiate_ephemeral_walker(xlat_exp_t *node, void *uctx) { - fr_event_list_t *el = talloc_get_type_abort(uctx, fr_event_list_t); - xlat_call_t *call = &node->call; + fr_event_list_t *el; + xlat_call_t *call; xlat_inst_t *xi; xlat_thread_inst_t *xt; @@ -275,6 +275,9 @@ static int _xlat_instantiate_ephemeral_walker(xlat_exp_t *node, void *uctx) if (node->type != XLAT_FUNC) return 0; /* skip it */ + el = talloc_get_type_abort(uctx, fr_event_list_t); + call = &node->call; + fr_assert(!call->inst && !call->thread_inst); /* @@ -322,6 +325,7 @@ static int _xlat_instantiate_ephemeral_walker(xlat_exp_t *node, void *uctx) * @note This must only be used for xlats created at runtime. * * @param[in] head of xlat tree to create instance data for. + * @param[in] el event list used to run any instantiate data */ int xlat_instantiate_ephemeral(xlat_exp_head_t *head, fr_event_list_t *el) {