getcolorusage() leaked in i_get_anonymous_color_histo() on too many colors
authorTony Cook <tony@develop-help.com>
Sun, 21 Feb 2016 02:31:16 +0000 (13:31 +1100)
committerTony Cook <tony@develop-help.com>
Sun, 21 Feb 2016 02:31:16 +0000 (13:31 +1100)
i_get_anonymous_color_histo() leaked the sample buffer.

image.c

diff --git a/image.c b/image.c
index 6e1c58e..cbd1b38 100644 (file)
--- a/image.c
+++ b/image.c
@@ -1302,7 +1302,8 @@ i_get_anonymous_color_histo(i_img *im, unsigned int **col_usage, int maxc) {
       colorcnt += octt_add(ct, samp[x], samp[x+1], samp[x+2]);
       x += 3;
       if (colorcnt > maxc) { 
-       octt_delete(ct); 
+       octt_delete(ct);
+       myfree(samp);
        return -1; 
       }
     }