1
0
mirror of https://github.com/openbsd/src.git synced 2026-05-01 17:46:35 +00:00

Do not leak list on failure, reported by Huihui Huang.

This commit is contained in:
nicm
2026-02-23 08:58:40 +00:00
parent b4c21dd8c4
commit 0ed3ac6729

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: status.c,v 1.256 2026/01/14 19:43:43 nicm Exp $ */
/* $OpenBSD: status.c,v 1.257 2026/02/23 08:58:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1890,7 +1890,7 @@ status_prompt_complete_window_menu(struct client *c, struct session *s,
struct winlink *wl;
char **list = NULL, *tmp;
u_int lines = status_line_size(c), height;
u_int py, size = 0;
u_int py, size = 0, i;
if (c->tty.sy - lines < 3)
return (NULL);
@@ -1969,6 +1969,9 @@ status_prompt_complete_window_menu(struct client *c, struct session *s,
BOX_LINES_DEFAULT, NULL, NULL, NULL, NULL,
status_prompt_menu_callback, spm) != 0) {
menu_free(menu);
for (i = 0; i < size; i++)
free(list[i]);
free(list);
free(spm);
return (NULL);
}