Do not leak items if not using them because of synchronized update.

This commit is contained in:
nicm
2025-12-19 08:46:25 +00:00
parent 1c7e164c22
commit 74f60951cc

View File

@@ -1738,8 +1738,16 @@ screen_write_collect_flush(struct screen_write_ctx *ctx, int scroll_only,
u_int y, cx, cy, last, items = 0;
struct tty_ctx ttyctx;
if (s->mode & MODE_SYNC)
if (s->mode & MODE_SYNC) {
for (y = 0; y < screen_size_y(s); y++) {
cl = &ctx->s->write_list[y];
TAILQ_FOREACH_SAFE(ci, &cl->items, entry, tmp) {
TAILQ_REMOVE(&cl->items, ci, entry);
screen_write_free_citem(ci);
}
}
return;
}
if (ctx->scrolled != 0) {
log_debug("%s: scrolled %u (region %u-%u)", __func__,