]> git.imager.perl.org - imager.git/blobdiff - image.c
Coverity complained colors could be left uninitialized.
[imager.git] / image.c
diff --git a/image.c b/image.c
index 6e1c58e02b81d33f314ec6fbc0777d13d17db3f2..cdfa2ed4aaa1a5575b239be374c7d667d4d84dee 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; 
       }
     }
@@ -1715,6 +1716,9 @@ i_test_format_probe(io_glue *data, int length) {
     /* JPEG 2000 
        This might match a little loosely */
     FORMAT_ENTRY("\x00\x00\x00\x0CjP  \x0D\x0A\x87\x0A", "jp2"),
+
+    /* FLIF - Free Lossless Image Format - https://flif.info/spec.html */
+    FORMAT_ENTRY("FLIF", "flif")
   };
   static const struct magic_entry more_formats[] = {
     /* these were originally both listed as ico, but cur files can
@@ -1798,7 +1802,8 @@ i_img_is_monochrome(i_img *im, int *zero_is_white) {
   if (im->type == i_palette_type
       && i_colorcount(im) == 2) {
     i_color colors[2];
-    i_getcolors(im, 0, colors, 2);
+    if (!i_getcolors(im, 0, colors, 2))
+      return 0;
     if (im->channels == 3) {
       if (colors[0].rgb.r == 255 && 
           colors[0].rgb.g == 255 &&