From 6987aaaa3f497a07795ad8b75263ed482ee42c42 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 15 Mar 2023 19:23:22 +0000 Subject: [PATCH] Do not leak screen in popups, GitHub issue 3492. --- usr.bin/tmux/cmd-display-menu.c | 5 ++++- usr.bin/tmux/popup.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.bin/tmux/cmd-display-menu.c b/usr.bin/tmux/cmd-display-menu.c index dc7bc21a5c8..da30e525548 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.38 2023/01/20 21:36:00 nicm Exp $ */ +/* $OpenBSD: cmd-display-menu.c,v 1.39 2023/03/15 19:23:22 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott @@ -276,6 +276,7 @@ cmd_display_menu_get_position(struct client *tc, struct cmdq_item *item, log_debug("%s: -y: %s = %s = %u (-h %u)", __func__, yp, p, *py, h); free(p); + format_free(ft); return (1); } @@ -470,11 +471,13 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item) cmd_free_argv(argc, argv); if (env != NULL) environ_free(env); + free(cwd); free(title); return (CMD_RETURN_NORMAL); } if (env != NULL) environ_free(env); + free(cwd); free(title); cmd_free_argv(argc, argv); return (CMD_RETURN_WAIT); diff --git a/usr.bin/tmux/popup.c b/usr.bin/tmux/popup.c index e69ae5e9d10..ad2e1c8cda8 100644 --- a/usr.bin/tmux/popup.c +++ b/usr.bin/tmux/popup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: popup.c,v 1.47 2023/01/20 21:36:00 nicm Exp $ */ +/* $OpenBSD: popup.c,v 1.48 2023/03/15 19:23:22 nicm Exp $ */ /* * Copyright (c) 2020 Nicholas Marriott @@ -253,6 +253,7 @@ popup_draw_cb(struct client *c, void *data, struct screen_redraw_ctx *rctx) tty_draw_line(tty, &s, 0, i, pd->sx, px, py + i, &defaults, palette); } + screen_free(&s); if (pd->md != NULL) { c->overlay_check = NULL; c->overlay_data = NULL; -- 2.20.1