From 7ad34fc28242b72c504450ea03c71f9b5375dcdf Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 28 Aug 2021 01:57:20 -0400 Subject: [PATCH] sixel: knock out memory leak when replacing annihilated sprixcells #2104 --- src/lib/sixel.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/sixel.c b/src/lib/sixel.c index 9e588e683..ed2883ef9 100644 --- a/src/lib/sixel.c +++ b/src/lib/sixel.c @@ -239,6 +239,7 @@ int sixel_wipe(sprixel* s, int ycell, int xcell){ s->wipes_outstanding = true; } change_p2(s->glyph.buf, SIXEL_P2_TRANS); + assert(NULL == s->n->tam[s->dimx * ycell + xcell].auxvector); s->n->tam[s->dimx * ycell + xcell].auxvector = auxvec; return 0; } @@ -397,9 +398,15 @@ extract_color_table(const uint32_t* data, int linesize, int cols, if(rgba_trans_p(*rgb, bargs->transcolor)){ if(sy % cdimy == 0 && visx % cdimx == 0){ tam[txyidx].state = SPRIXCELL_ANNIHILATED_TRANS; + free(tam[txyidx].auxvector); + tam[txyidx].auxvector = NULL; } }else{ tam[txyidx].state = SPRIXCELL_ANNIHILATED; + if(sy % cdimy == 0 && visx % cdimx == 0){ + free(tam[txyidx].auxvector); + tam[txyidx].auxvector = NULL; + } } } unsigned char comps[RGBSIZE];