From 74f60951cc0f098265fc58336f001bc006c6585c Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 19 Dec 2025 08:46:25 +0000 Subject: [PATCH] Do not leak items if not using them because of synchronized update. --- screen-write.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/screen-write.c b/screen-write.c index 86eb45c2..aed6582f 100644 --- a/screen-write.c +++ b/screen-write.c @@ -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__,