From: Alan T. DeKok Date: Tue, 29 Aug 2017 14:48:51 +0000 (-0400) Subject: add destructor for parallel state X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5677e742e394d0818fd27351f339ccfcb18cf4a3;p=thirdparty%2Ffreeradius-server.git add destructor for parallel state --- diff --git a/src/main/unlang_interpret.c b/src/main/unlang_interpret.c index 6cb7d72ac1a..7eae996edd0 100644 --- a/src/main/unlang_interpret.c +++ b/src/main/unlang_interpret.c @@ -983,6 +983,19 @@ static rlm_rcode_t unlang_parallel_resume(REQUEST *request, unlang_stack_t *stac return RLM_MODULE_YIELD; } +static int parallel_state_free(unlang_parallel_t *state) +{ + int i; + + for (i = 0; i < state->num_children; i++) { + if (state->children[i].child) { + talloc_free(state->children[i].child); + } + } + + return 0; +} + static unlang_action_t unlang_parallel(REQUEST *request, unlang_stack_t *stack, rlm_rcode_t *presult, int *priority) { @@ -1013,6 +1026,7 @@ static unlang_action_t unlang_parallel(REQUEST *request, unlang_stack_t *stack, }; (void) talloc_set_type(state, unlang_parallel_t); + talloc_set_destructor(state, parallel_state_free); state->result = RLM_MODULE_FAIL; state->priority = -1; /* as-yet unset */ state->g = g;