From 19289bad5ef60f4c5ca2b45c0e495db60ed34267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 28 Mar 2021 12:57:49 +0200 Subject: [PATCH] sixel: free backing buffer if final image size is zero --- sixel.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sixel.c b/sixel.c index c856122e..cac60493 100644 --- a/sixel.c +++ b/sixel.c @@ -726,6 +726,11 @@ sixel_unhook(struct terminal *term) term->sixel.image.height = term->sixel.max_non_empty_row_no + 1; } + if (term->sixel.image.height == 0 || term->sixel.image.width == 0) { + /* We won’t be emitting any sixels - free backing image */ + free(term->sixel.image.data); + } + int pixel_row_idx = 0; int pixel_rows_left = term->sixel.image.height; const int stride = term->sixel.image.width * sizeof(uint32_t);