From: Arran Cudbard-Bell Date: Sat, 7 Sep 2019 00:00:48 +0000 (-0500) Subject: Parent the VPs from the frame state for easy cleanup X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7dfa7cff118017f542aab0d5b54baba0a02adccf;p=thirdparty%2Ffreeradius-server.git Parent the VPs from the frame state for easy cleanup this possibly wasn't there before, because there used to be a union in the frame to hold instruction specific data --- diff --git a/src/lib/unlang/foreach.c b/src/lib/unlang/foreach.c index d1f73b83182..6b3137369cf 100644 --- a/src/lib/unlang/foreach.c +++ b/src/lib/unlang/foreach.c @@ -115,19 +115,19 @@ static unlang_action_t unlang_foreach(REQUEST *request, return UNLANG_ACTION_CALCULATE_RESULT; } + MEM(frame->state = foreach = talloc_zero(stack, unlang_frame_state_foreach_t)); + /* * Copy the VPs from the original request, this ensures deterministic * behaviour if someone decides to add or remove VPs in the set we're * iterating over. */ - if (tmpl_copy_vps(stack, &vps, request, g->vpt) < 0) { /* nothing to loop over */ + if (tmpl_copy_vps(frame->state, &vps, request, g->vpt) < 0) { /* nothing to loop over */ *presult = RLM_MODULE_NOOP; *priority = instruction->actions[RLM_MODULE_NOOP]; return UNLANG_ACTION_CALCULATE_RESULT; } - MEM(frame->state = foreach = talloc_zero(stack, unlang_frame_state_foreach_t)); - rad_assert(vps != NULL); foreach->request = request;