From: Arran Cudbard-Bell Date: Wed, 30 Apr 2025 18:12:11 +0000 (-0400) Subject: If we pass a NULL next to frame_set_next, just return calculate result, and NULLify... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2eab49329d00cd03bb16016bc5980bb654ea7703;p=thirdparty%2Ffreeradius-server.git If we pass a NULL next to frame_set_next, just return calculate result, and NULLify the frame->next pointer --- diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index d02ac1a30e8..97135253809 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -629,6 +629,19 @@ static inline void frame_repeat(unlang_stack_frame_t *frame, unlang_process_t pr static inline unlang_action_t frame_set_next(unlang_stack_frame_t *frame, unlang_t *unlang) { + /* + * We're skipping the remaining siblings, stop the + * interpreter from continuing and have it pop + * this frame, running cleanups normally. + * + * We don't explicitly cleanup here, otherwise we + * end up doing it twice and bad things happen. + */ + if (!unlang) { + frame->next = NULL; + return UNLANG_ACTION_CALCULATE_RESULT; + } + /* * Clean up this frame now, so that stats, etc. will be * processed using the correct frame.