From 4e3e50e42afb7ec8496aa3a5eb1491b03f0a3b9e Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Sun, 21 Feb 2016 13:29:18 +1100 Subject: [PATCH] getcolorcount() leaked in i_count_colors() on too many colors The sample array was leaked when the number of colors in the image exceeded the supplied limit. --- image.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/image.c b/image.c index f280a28c..6e1c58e0 100644 --- a/image.c +++ b/image.c @@ -1210,7 +1210,8 @@ i_count_colors(i_img *im,int maxc) { for(x = 0; x < samp_cnt; ) { colorcnt += octt_add(ct, samp[x], samp[x+1], samp[x+2]); x += 3; - if (colorcnt > maxc) { + if (colorcnt > maxc) { + myfree(samp); octt_delete(ct); return -1; } -- 2.39.5