]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
More efficient way of cleaning up frames
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 6 Apr 2021 10:46:03 +0000 (11:46 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 6 Apr 2021 10:46:03 +0000 (11:46 +0100)
src/lib/unlang/interpret.c
src/lib/unlang/unlang_priv.h

index d1ed246e23d9e15ae428b3ac708d8cd964ce7b70..8ee996fbe401f83a97e8c9f2562cb44256e0f47d 100644 (file)
@@ -865,6 +865,8 @@ static inline CC_HINT(always_inline) void frame_signal(request_t *request, fr_st
 
        (void)talloc_get_type_abort(request, request_t);        /* Check the request hasn't already been freed */
 
+       if (limit == 0) limit = 1;      /* Never signal frame 0 */
+
        fr_assert(stack->depth > 0);
 
        /*
@@ -880,8 +882,9 @@ static inline CC_HINT(always_inline) void frame_signal(request_t *request, fr_st
                for (i = depth; i > limit; i--) {
                        frame = &stack->frame[i];
                        if (frame->signal) frame->signal(request, frame, action);
-                       frame_pop(request->stack);
+                       frame_cleanup(frame);
                }
+               stack->depth = i;
                return;
        }
 
index 376c31128bf93b0c03611b3c215cd4ba30338333..174ba134b8e66737227e1563c800db7bfab864d1 100644 (file)
@@ -375,10 +375,7 @@ static inline void frame_cleanup(unlang_stack_frame_t *frame)
        /*
         *      Don't clear top_frame flag, bad things happen...
         */
-       repeatable_clear(frame);
-       break_point_clear(frame);
-       return_point_clear(frame);
-       yielded_clear(frame);
+       frame->uflags &= UNWIND_FLAG_TOP_FRAME;
        if (frame->state) {
                talloc_free_children(frame->state); /* *(ev->parent) = NULL in event.c */
                TALLOC_FREE(frame->state);