]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
various bug fixes in subrequest.c
authorAlan T. DeKok <aland@freeradius.org>
Sun, 15 Feb 2026 16:33:06 +0000 (11:33 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 15 Feb 2026 17:47:50 +0000 (12:47 -0500)
free child for completeness

if we fail to start the child, then we had pushed a frame in the
parent which is now invalid.  So we mark that frame as unwinding
which does little more than reduce maximum memory pressure, as it
was parented from "request"

src/lib/unlang/subrequest.c

index 90229b619fc9b08b6826fcbe6cf8f2ff3aec70ef..1646b3c4b2f2f3887840d5f4949d95d51be4850c 100644 (file)
@@ -192,6 +192,7 @@ static unlang_action_t unlang_subrequest_init(unlang_result_t *p_result, request
        child = unlang_io_subrequest_alloc(request, gext->dict, UNLANG_DETACHABLE);
        if (!child) {
        fail:
+               talloc_free(child);
                return UNLANG_ACTION_FAIL;
        }
        /*
@@ -473,7 +474,10 @@ int unlang_subrequest_child_push(unlang_result_t *p_result, request_t *child, vo
         *      This instruction will mark the parent as runnable
         *      when it executed.
         */
-       if (unlang_child_request_init(cr, cr, child, p_result, NULL, unique_session_ptr, free_child) < 0) return -1;
+       if (unlang_child_request_init(cr, cr, child, p_result, NULL, unique_session_ptr, free_child) < 0) {
+               unwind_set(frame);
+               return -1;
+       }
 
        return 0;
 }