From: Arran Cudbard-Bell Date: Wed, 30 Apr 2025 04:11:54 +0000 (-0400) Subject: frame_pop can pop the top frame too X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7251e532370c98d9f17223e98bf98168bed3a26e;p=thirdparty%2Ffreeradius-server.git frame_pop can pop the top frame too --- diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index adf72fa841..4a0847ee62 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -595,10 +595,19 @@ static inline void frame_pop(request_t *request, unlang_stack_t *stack) { unlang_stack_frame_t *frame; - fr_assert(stack->depth > 1); + fr_assert(stack->depth >= 1); frame = &stack->frame[stack->depth]; + /* + * Signal the frame to get it back into a consistent state + * as we won't be calling the resume function. + */ + if (is_cancelled(frame)) { + if (frame->signal) frame->signal(request, frame, FR_SIGNAL_CANCEL); + repeatable_clear(frame); + } + /* * We clean up the retries when we pop the frame, not * when we do a frame_cleanup(). That's because @@ -617,16 +626,7 @@ static inline void frame_pop(request_t *request, unlang_stack_t *stack) frame_cleanup(frame); - frame = &stack->frame[--stack->depth]; - - /* - * Signal the frame to get it back into a consistent state - * as we won't be calling the resume function. - */ - if (is_cancelled(frame)) { - if (frame->signal) frame->signal(request, frame, FR_SIGNAL_CANCEL); - repeatable_clear(frame); - } + stack->depth--; } /** Mark the current stack frame up for repeat, and set a new process function