From 4b5f38321f88232fe991fb293af4cce6bf95269a Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 7 Aug 2023 10:52:00 +0000 Subject: [PATCH] Free title earlier, from Alexis Hildebrandt. --- usr.bin/tmux/cmd-display-menu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/usr.bin/tmux/cmd-display-menu.c b/usr.bin/tmux/cmd-display-menu.c index da30e525548..712524c9a55 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.39 2023/03/15 19:23:22 nicm Exp $ */ +/* $OpenBSD: cmd-display-menu.c,v 1.40 2023/08/07 10:52:00 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott @@ -316,6 +316,7 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item) else title = xstrdup(""); menu = menu_create(title); + free(title); for (i = 0; i != count; /* nothing */) { name = args_string(args, i++); @@ -326,7 +327,6 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item) if (count - i < 2) { cmdq_error(item, "not enough arguments"); - free(title); menu_free(menu); return (CMD_RETURN_ERROR); } @@ -338,7 +338,6 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item) menu_add_item(menu, &menu_item, item, tc, target); } - free(title); if (menu == NULL) { cmdq_error(item, "invalid menu arguments"); return (CMD_RETURN_ERROR); -- 2.20.1