diff --git a/arguments.c b/arguments.c index a4b6a0f35..00af96311 100644 --- a/arguments.c +++ b/arguments.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arguments.c,v 1.66 2026/06/26 09:54:56 nicm Exp $ */ +/* $OpenBSD: arguments.c,v 1.67 2026/08/25 06:04:33 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott @@ -762,8 +762,6 @@ args_make_commands_now(struct cmd *self, struct cmdq_item *item, u_int idx, cmdq_error(item, "%s", error); free(error); } - else - cmdlist->references++; args_make_commands_free(state); return (cmdlist); } @@ -827,8 +825,10 @@ args_make_commands(struct args_command_state *state, int argc, char **argv, int i; if (state->cmdlist != NULL) { - if (argc == 0) + if (argc == 0) { + state->cmdlist->references++; return (state->cmdlist); + } return (cmd_list_copy(state->cmdlist, argc, argv)); } diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index ac1117347..1d135b834 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-command-prompt.c,v 1.75 2026/06/25 11:39:11 nicm Exp $ */ +/* $OpenBSD: cmd-command-prompt.c,v 1.76 2026/08/25 06:04:33 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -242,9 +242,11 @@ cmd_command_prompt_callback(struct client *c, void *data, const char *s, } else if (item == NULL) { new_item = cmdq_get_command(cmdlist, NULL); cmdq_append(c, new_item); + cmd_list_free(cmdlist); } else { new_item = cmdq_get_command(cmdlist, cmdq_get_state(item)); cmdq_insert_after(item, new_item); + cmd_list_free(cmdlist); } cmd_free_argv(argc, argv); diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 49b92a996..59d34f9d6 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-if-shell.c,v 1.86 2025/08/01 09:05:51 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.87 2026/08/25 06:04:33 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -98,6 +98,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item) return (CMD_RETURN_ERROR); new_item = cmdq_get_command(cmdlist, cmdq_get_state(item)); cmdq_insert_after(item, new_item); + cmd_list_free(cmdlist); return (CMD_RETURN_NORMAL); } @@ -164,9 +165,11 @@ cmd_if_shell_callback(struct job *job) } else if (item == NULL) { new_item = cmdq_get_command(cmdlist, NULL); cmdq_append(c, new_item); + cmd_list_free(cmdlist); } else { new_item = cmdq_get_command(cmdlist, cmdq_get_state(item)); cmdq_insert_after(item, new_item); + cmd_list_free(cmdlist); } out: diff --git a/cmd-run-shell.c b/cmd-run-shell.c index 59d5aeea6..7e0c62e56 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.93 2026/07/17 12:42:51 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.94 2026/08/25 06:04:33 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -233,9 +233,11 @@ cmd_run_shell_timer(__unused int fd, __unused short events, void* arg) } else if (item == NULL) { new_item = cmdq_get_command(cmdlist, NULL); cmdq_append(c, new_item); + cmd_list_free(cmdlist); } else { new_item = cmdq_get_command(cmdlist, cmdq_get_state(item)); cmdq_insert_after(item, new_item); + cmd_list_free(cmdlist); } if (cdata->item != NULL) diff --git a/server-client.c b/server-client.c index 259e254d8..4d8c7165c 100644 --- a/server-client.c +++ b/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.507 2026/08/24 21:17:19 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.508 2026/08/25 06:14:16 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -526,6 +526,8 @@ server_client_lost(struct client *c) free(c->title); free(c->path); free((void *)c->cwd); + free(c->exit_session); + free(c->exit_message); evtimer_del(&c->repeat_timer); evtimer_del(&c->click_timer); @@ -2407,8 +2409,6 @@ server_client_check_exit(struct client *c, int force) proc_send(c->peer, c->exit_msgtype, -1, name, strlen(name) + 1); break; } - free(c->exit_session); - free(c->exit_message); } /* Redraw timer callback. */ diff --git a/window-panes.c b/window-panes.c index f1104b4f3..e65e59606 100644 --- a/window-panes.c +++ b/window-panes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-panes.c,v 1.4 2026/07/29 14:06:32 nicm Exp $ */ +/* $OpenBSD: window-panes.c,v 1.5 2026/08/25 06:04:33 nicm Exp $ */ /* * Copyright (c) 2026 Nicholas Marriott @@ -1009,6 +1009,7 @@ window_panes_run_command(struct window_panes_modedata *data, struct client *c, } else { new_item = cmdq_get_command(cmdlist, NULL); cmdq_append(c, new_item); + cmd_list_free(cmdlist); } free(expanded); }