]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Parent the VPs from the frame state for easy cleanup
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 7 Sep 2019 00:00:48 +0000 (19:00 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 7 Sep 2019 00:00:48 +0000 (19:00 -0500)
this possibly wasn't there before, because there used to be a union in the frame to hold instruction specific data

src/lib/unlang/foreach.c

index d1f73b831826d9d003ec4b9874301edb72f41aa9..6b3137369cfdd31c6e2f166e000bb33697866a8d 100644 (file)
@@ -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;