From: Arran Cudbard-Bell Date: Tue, 6 Apr 2021 10:46:03 +0000 (+0100) Subject: More efficient way of cleaning up frames X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3269255ffc4c78976e99e3c754d3047a2fcff84d;p=thirdparty%2Ffreeradius-server.git More efficient way of cleaning up frames --- diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index d1ed246e23..8ee996fbe4 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -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; } diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index 376c31128b..174ba134b8 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -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);