]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
frame_pop can pop the top frame too
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 30 Apr 2025 04:11:54 +0000 (00:11 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 30 Apr 2025 20:22:49 +0000 (16:22 -0400)
src/lib/unlang/unlang_priv.h

index adf72fa8416b9338255beac8fe56834da28940f6..4a0847ee623d4fefe5b91690be5e7d1dedce0390 100644 (file)
@@ -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