From: Todd C. Miller Date: Thu, 23 Aug 2018 17:10:57 +0000 (-0600) Subject: Move the loop to free the monitor_messages list into free_exec_closure_pty() X-Git-Tag: SUDO_1_8_25^2~34 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=59e5e379be5662e3d8d5968d989234db0a04b8a4;p=sudo Move the loop to free the monitor_messages list into free_exec_closure_pty() --- diff --git a/src/exec_pty.c b/src/exec_pty.c index 36b9e7d5d..d906feb55 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -1206,6 +1206,7 @@ fill_exec_closure_pty(struct exec_closure_pty *ec, struct command_status *cstat, static void free_exec_closure_pty(struct exec_closure_pty *ec) { + struct monitor_message *msg; debug_decl(free_exec_closure_pty, SUDO_DEBUG_EXEC) sudo_ev_base_free(ec->evbase); @@ -1222,6 +1223,11 @@ free_exec_closure_pty(struct exec_closure_pty *ec) sudo_ev_free(ec->sigchld_event); sudo_ev_free(ec->sigwinch_event); + while ((msg = TAILQ_FIRST(&ec->monitor_messages)) != NULL) { + TAILQ_REMOVE(&ec->monitor_messages, msg, entries); + free(msg); + } + debug_return; } @@ -1236,7 +1242,6 @@ exec_pty(struct command_details *details, struct command_status *cstat) { int io_pipe[3][2] = { { -1, -1 }, { -1, -1 }, { -1, -1 } }; bool interpose[3] = { false, false, false }; - struct monitor_message *msg; struct exec_closure_pty ec = { 0 }; struct plugin_container *plugin; sigset_t set, oset; @@ -1530,10 +1535,7 @@ exec_pty(struct command_details *details, struct command_status *cstat) /* Free things up. */ free_exec_closure_pty(&ec); - while ((msg = TAILQ_FIRST(&ec.monitor_messages)) != NULL) { - TAILQ_REMOVE(&ec.monitor_messages, msg, entries); - free(msg); - } + debug_return_bool(true); }