From 80b5a9d1ea30ce7b2df4620628c98eeda09b7514 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 22 Aug 2021 13:48:29 +0000 Subject: [PATCH] Do not double free expanded path in source-file, also remove some unnecessary assignments. --- usr.bin/tmux/cmd-display-menu.c | 4 +--- usr.bin/tmux/cmd-source-file.c | 4 ++-- usr.bin/tmux/file.c | 6 +++--- usr.bin/tmux/server-client.c | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/usr.bin/tmux/cmd-display-menu.c b/usr.bin/tmux/cmd-display-menu.c index 04d89a16b0c..50dec6defdb 100644 --- a/usr.bin/tmux/cmd-display-menu.c +++ b/usr.bin/tmux/cmd-display-menu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-menu.c,v 1.29 2021/08/21 10:22:38 nicm Exp $ */ +/* $OpenBSD: cmd-display-menu.c,v 1.30 2021/08/22 13:48:29 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott @@ -121,8 +121,6 @@ cmd_display_menu_get_position(struct client *tc, struct cmdq_item *item, if (sr != NULL) break; } - if (line == lines) - ranges = &tc->status.entries[0].ranges; if (sr != NULL) { format_add(ft, "popup_window_status_line_x", "%u", diff --git a/usr.bin/tmux/cmd-source-file.c b/usr.bin/tmux/cmd-source-file.c index adefe9e1a23..f150186554e 100644 --- a/usr.bin/tmux/cmd-source-file.c +++ b/usr.bin/tmux/cmd-source-file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-source-file.c,v 1.51 2021/08/21 10:22:39 nicm Exp $ */ +/* $OpenBSD: cmd-source-file.c,v 1.52 2021/08/22 13:48:29 nicm Exp $ */ /* * Copyright (c) 2008 Tiago Cunha @@ -180,12 +180,12 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item) free(pattern); continue; } - free(expanded); free(pattern); for (j = 0; j < g.gl_pathc; j++) cmd_source_file_add(cdata, g.gl_pathv[j]); } + free(expanded); cdata->after = item; cdata->retval = retval; diff --git a/usr.bin/tmux/file.c b/usr.bin/tmux/file.c index 55a67c211b4..acf08a8f4cc 100644 --- a/usr.bin/tmux/file.c +++ b/usr.bin/tmux/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.11 2021/06/10 07:51:43 nicm Exp $ */ +/* $OpenBSD: file.c,v 1.12 2021/08/22 13:48:29 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott @@ -558,7 +558,7 @@ file_write_open(struct client_files *files, struct tmuxpeer *peer, log_debug("open write file %d %s", msg->stream, path); find.stream = msg->stream; - if ((cf = RB_FIND(client_files, files, &find)) != NULL) { + if (RB_FIND(client_files, files, &find) != NULL) { error = EBADF; goto reply; } @@ -717,7 +717,7 @@ file_read_open(struct client_files *files, struct tmuxpeer *peer, log_debug("open read file %d %s", msg->stream, path); find.stream = msg->stream; - if ((cf = RB_FIND(client_files, files, &find)) != NULL) { + if (RB_FIND(client_files, files, &find) != NULL) { error = EBADF; goto reply; } diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 3bcc496547b..9f08166aee7 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.383 2021/08/21 17:25:32 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.384 2021/08/22 13:48:29 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -280,7 +280,7 @@ server_client_open(struct client *c, char **cause) static void server_client_attached_lost(struct client *c) { - struct session *s = c->session; + struct session *s; struct window *w; struct client *loop; struct client *found; -- 2.20.1