]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Detach cancelled children from their parents
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 28 Mar 2023 00:10:16 +0000 (18:10 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 28 Mar 2023 00:10:16 +0000 (18:10 -0600)
src/lib/unlang/interpret.c

index 5a62a99db3bf6dc9d4c2689f865361f414e489cb..b272f05ea4bb5ea06243003943e071ecb1cecc77 100644 (file)
@@ -1118,6 +1118,15 @@ void unlang_interpret_signal(request_t *request, fr_state_signal_t action)
        case FR_SIGNAL_CANCEL:
                unlang_interpret_request_stop(request);         /* Stop gets the request in a consistent state */
                unlang_interpret_request_done(request);         /* Done signals the request is complete */
+
+               /*
+                *      If we're cancelling a child, detach it from
+                *      its parent, so we don't leak memory allocated
+                *      in request_detachable_init.
+                */
+               if (request_is_detachable(request) && (request_detach(request) < 0)) {
+                       RPEDEBUG("Failed detaching request on cancel");
+               }
                break;
 
        case FR_SIGNAL_DETACH: