From: Tony Cook Date: Sun, 21 Feb 2016 02:29:18 +0000 (+1100) Subject: getcolorcount() leaked in i_count_colors() on too many colors X-Git-Tag: v1.004_001~18 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/4e3e50e42afb7ec8496aa3a5eb1491b03f0a3b9e 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. --- 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; }