From: Arran Cudbard-Bell Date: Tue, 28 Mar 2023 00:10:16 +0000 (-0600) Subject: Detach cancelled children from their parents X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43f9d176bd16fc945c6d8d3c0639358935420781;p=thirdparty%2Ffreeradius-server.git Detach cancelled children from their parents --- diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index 5a62a99db3b..b272f05ea4b 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -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: