Fix underflow in free_window_info

At the end this is called after `WIN_MESSAGE` is reset to `-1`, so we
need a check here.
This commit is contained in:
Brian Campbell
2022-06-26 15:30:58 +01:00
parent d2ca61a0a0
commit f9d7bc63bf

View File

@@ -1769,7 +1769,8 @@ free_window_info(struct WinDesc *cw, boolean free_data)
int i;
if (cw->data) {
if (cw == wins[WIN_MESSAGE] && cw->rows > cw->maxrow)
if (WIN_MESSAGE != WIN_ERR && cw == wins[WIN_MESSAGE]
&& cw->rows > cw->maxrow)
cw->maxrow = cw->rows; /* topl data */
for (i = 0; i < cw->maxrow; i++)
if (cw->data[i]) {