From 46a63c5eed08f955792feda8f04b90a6f4ec2839 Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 2 Aug 2021 00:51:51 -0400 Subject: [PATCH] kitty: kill memory leak in self-referential animation #2012 --- src/lib/kitty.c | 6 ++++-- src/lib/termdesc.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/kitty.c b/src/lib/kitty.c index 0ee9845024..cd1fd748db 100644 --- a/src/lib/kitty.c +++ b/src/lib/kitty.c @@ -739,9 +739,11 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, int cols, } tam[tyx].auxvector = tmp; }else if(level == KITTY_SELFREF){ - tam[tyx].auxvector = malloc(sizeof(tam[tyx].state)); if(tam[tyx].auxvector == NULL){ - goto err; + tam[tyx].auxvector = malloc(sizeof(tam[tyx].state)); + if(tam[tyx].auxvector == NULL){ + goto err; + } } memcpy(tam[tyx].auxvector, &tam[tyx].state, sizeof(tam[tyx].state)); } diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index f727e5b8d4..aa5ff7bb8f 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -512,7 +512,7 @@ apply_term_heuristics(tinfo* ti, const char* termname, int fd, if(add_smulx_escapes(ti, tablelen, tableused)){ return -1; } - if(compare_versions(ti->termversion, "0.22.0") >= 0){ + if(compare_versions(ti->termversion, "0.22.1") >= 0){ setup_kitty_bitmaps(ti, fd, KITTY_SELFREF); }else if(compare_versions(ti->termversion, "0.20.0") >= 0){ setup_kitty_bitmaps(ti, fd, KITTY_ANIMATION);