Blob Blame History Raw
diff -urNp a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
--- a/app/widgets/gimpdockbook.c	2018-08-22 13:08:57.678276508 +0200
+++ b/app/widgets/gimpdockbook.c	2018-08-22 13:10:30.657080868 +0200
@@ -1312,7 +1312,7 @@ gimp_dockbook_recreate_tab_widgets (Gimp
       GtkWidget *tab_widget;
 
       if (only_auto &&
-          ! gimp_dockable_get_tab_style (dockable) == GIMP_TAB_STYLE_AUTOMATIC)
+          !(gimp_dockable_get_tab_style (dockable) == GIMP_TAB_STYLE_AUTOMATIC))
         continue;
 
       tab_widget = gimp_dockbook_create_tab_widget (dockbook, dockable);
diff -urNp a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
--- a/app/xcf/xcf-save.c	2018-08-22 13:08:57.648276570 +0200
+++ b/app/xcf/xcf-save.c	2018-08-22 13:14:27.090551257 +0200
@@ -991,6 +991,7 @@ xcf_save_prop (XcfInfo    *info,
             if (tmp_error)
               {
                 g_propagate_error (error, tmp_error);
+                va_end (args);
                 return FALSE;
               }
 
@@ -1038,6 +1039,7 @@ xcf_save_prop (XcfInfo    *info,
         if (tmp_error)
           {
             g_propagate_error (error, tmp_error);
+            va_end (args);
             return FALSE;
           }
 
@@ -1104,6 +1106,7 @@ xcf_save_prop (XcfInfo    *info,
         if (tmp_error)
           {
             g_propagate_error (error, tmp_error);
+            va_end (args);
             return FALSE;
           }
 
diff -urNp a/plug-ins/common/crop-zealous.c b/plug-ins/common/crop-zealous.c
--- a/plug-ins/common/crop-zealous.c	2018-08-22 13:08:57.551276769 +0200
+++ b/plug-ins/common/crop-zealous.c	2018-08-22 13:18:11.055019697 +0200
@@ -251,6 +251,7 @@ do_zcrop (GimpDrawable *drawable,
       (livingcols == width && livingrows == height))
     {
       g_message (_("Nothing to crop."));
+      g_free (buffer);
       g_free (killrows);
       g_free (killcols);
       return;
diff -urNp a/plug-ins/common/file-cel.c b/plug-ins/common/file-cel.c
--- a/plug-ins/common/file-cel.c	2018-08-22 13:08:57.549276773 +0200
+++ b/plug-ins/common/file-cel.c	2018-08-22 14:17:02.643223269 +0200
@@ -365,6 +365,7 @@ load_image (const gchar  *file,
     {
       g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                    _("EOF or error while reading image header"));
+      close (fp);
       return -1;
     }
 
@@ -385,6 +386,7 @@ load_image (const gchar  *file,
         {
           g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                        _("EOF or error while reading image header"));
+          close (fp);
           return -1;
         }
 
@@ -393,6 +395,7 @@ load_image (const gchar  *file,
         {
           g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                        _("is not a CEL image file"));
+          close (fp);
           return -1;
         }
 
@@ -407,6 +410,7 @@ load_image (const gchar  *file,
         default:
           g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                        _("illegal bpp value in image: %hhu"), bpp);
+          close (fp);
           return -1;
         }
 
@@ -423,6 +427,7 @@ load_image (const gchar  *file,
                    _("illegal image dimensions: width: %d, horizontal offset: "
                      "%d, height: %d, vertical offset: %d"),
                    width, offx, height, offy);
+      close (fp);
       return -1;
     }
 
@@ -434,7 +439,7 @@ load_image (const gchar  *file,
   if (image == -1)
     {
       g_set_error (error, 0, 0, _("Can't create a new image"));
-      fclose (fp);
+      close (fp);
       return -1;
     }
 
@@ -472,6 +477,7 @@ load_image (const gchar  *file,
             {
               g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                            _("EOF or error while reading image data"));
+              close (fp);
               return -1;
             }
 
@@ -507,6 +513,7 @@ load_image (const gchar  *file,
             {
               g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                            _("EOF or error while reading image data"));
+              close (fp);
               return -1;
             }
 
@@ -532,6 +539,7 @@ load_image (const gchar  *file,
             {
               g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                            _("EOF or error while reading image data"));
+              close (fp);
               return -1;
             }
 
@@ -549,6 +557,7 @@ load_image (const gchar  *file,
         default:
           g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                        _("Unsupported bit depth (%d)!"), bpp);
+          close (fp);
           return -1;
         }
 
@@ -590,7 +599,7 @@ load_image (const gchar  *file,
       if (fp != NULL)
         {
           colours = load_palette (palette_file, fp, palette, error);
-          fclose (fp);
+          close (fp);
           if (colours < 0 || *error)
             return -1;
         }
diff -urNp a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c
--- a/plug-ins/common/file-gbr.c	2018-08-22 13:08:57.553276765 +0200
+++ b/plug-ins/common/file-gbr.c	2018-08-22 14:15:37.267405649 +0200
@@ -402,6 +402,7 @@ load_image (const gchar  *filename,
                      "bytes=%lu"), gimp_filename_to_utf8 (filename),
                    (unsigned long int)bh.width, (unsigned long int)bh.height,
                    (unsigned long int)bh.bytes);
+      close (fd);
       return -1;
     }
 
@@ -583,6 +584,7 @@ load_image (const gchar  *filename,
                  "GIMP Brushes must be GRAY or RGBA\n",
                  bh.bytes);
       g_free (name);
+      close (fd);
       return -1;
     }
 
diff -urNp a/plug-ins/common/file-gif-load.c b/plug-ins/common/file-gif-load.c
--- a/plug-ins/common/file-gif-load.c	2018-08-22 13:08:57.552276767 +0200
+++ b/plug-ins/common/file-gif-load.c	2018-08-22 14:14:25.643557884 +0200
@@ -365,6 +365,7 @@ load_image (const gchar  *filename,
   if (! ReadOK (fd, buf, 6))
     {
       g_message ("Error reading magic number");
+      close (fd);
       return -1;
     }
 
@@ -372,6 +373,7 @@ load_image (const gchar  *filename,
     {
       g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                    "%s", _("This is not a GIF file"));
+      close (fd);
       return -1;
     }
 
@@ -381,12 +383,14 @@ load_image (const gchar  *filename,
   if ((strcmp (version, "87a") != 0) && (strcmp (version, "89a") != 0))
     {
       g_message ("Bad version number, not '87a' or '89a'");
+      close (fd);
       return -1;
     }
 
   if (! ReadOK (fd, buf, 7))
     {
       g_message ("Failed to read screen descriptor");
+      close (fd);
       return -1;
     }
 
@@ -404,6 +408,7 @@ load_image (const gchar  *filename,
                           &GifScreen.GrayScale))
         {
           g_message ("Error reading global colormap");
+          close (fd);
           return -1;
         }
     }
@@ -421,12 +426,14 @@ load_image (const gchar  *filename,
       if (! ReadOK (fd, &c, 1))
         {
           g_message ("EOF / read error on image data");
+          close (fd);
           return image_ID; /* will be -1 if failed on first image! */
         }
 
       if (c == ';')
         {
           /* GIF terminator */
+          close (fd);
           return image_ID;
         }
 
@@ -436,6 +443,7 @@ load_image (const gchar  *filename,
           if (! ReadOK (fd, &c, 1))
             {
               g_message ("EOF / read error on extension function code");
+              close (fd);
               return image_ID; /* will be -1 if failed on first image! */
             }
 
@@ -455,6 +463,7 @@ load_image (const gchar  *filename,
       if (! ReadOK (fd, buf, 9))
         {
           g_message ("Couldn't read left/top/width/height");
+          close (fd);
           return image_ID; /* will be -1 if failed on first image! */
         }
 
@@ -467,6 +476,7 @@ load_image (const gchar  *filename,
           if (! ReadColorMap (fd, bitPixel, localColorMap, &grayScale))
             {
               g_message ("Error reading local colormap");
+              close (fd);
               return image_ID; /* will be -1 if failed on first image! */
             }
 
@@ -514,6 +524,7 @@ load_image (const gchar  *filename,
         break;
     }
 
+  close (fd);
   return image_ID;
 }
 
diff -urNp a/plug-ins/common/file-gih.c b/plug-ins/common/file-gih.c
--- a/plug-ins/common/file-gih.c	2018-08-22 13:08:57.551276769 +0200
+++ b/plug-ins/common/file-gih.c	2018-08-22 14:13:22.227692000 +0200
@@ -736,6 +736,7 @@ gih_load_image (const gchar  *filename,
     }
 
   g_string_free (buffer, TRUE);
+  close (fd);
 
   return image_ID;
 }
diff -urNp a/plug-ins/common/file-pat.c b/plug-ins/common/file-pat.c
--- a/plug-ins/common/file-pat.c	2018-08-22 13:08:57.545276782 +0200
+++ b/plug-ins/common/file-pat.c	2018-08-22 14:35:42.168467750 +0200
@@ -408,6 +408,7 @@ load_image (const gchar  *filename,
     default:
       g_message ("Unsupported pattern depth: %d\n"
                  "GIMP Patterns must be GRAY or RGB", ph.bytes);
+      close (fd);
       return -1;
     }
 
@@ -421,6 +422,7 @@ load_image (const gchar  *filename,
                      "bytes=%lu"), gimp_filename_to_utf8 (filename),
                    (unsigned long int)ph.width, (unsigned long int)ph.height,
                    (unsigned long int)ph.bytes);
+      close (fd);
       return -1;
     }
 
@@ -464,6 +466,8 @@ load_image (const gchar  *filename,
 
   gimp_drawable_flush (drawable);
 
+  close (fd);
+
   return image_ID;
 }
 
diff -urNp a/plug-ins/common/file-pnm.c b/plug-ins/common/file-pnm.c
--- a/plug-ins/common/file-pnm.c	2018-08-22 13:08:57.545276782 +0200
+++ b/plug-ins/common/file-pnm.c	2018-08-22 14:37:56.382965940 +0200
@@ -1057,6 +1057,7 @@ save_image (const gchar  *filename,
 
             default:
               g_warning ("PNM: Unknown drawable_type\n");
+              close (fd);
               return FALSE;
             }
         }
@@ -1097,6 +1098,7 @@ save_image (const gchar  *filename,
 
             default:
               g_warning ("PNM: Unknown drawable_type\n");
+              close (fd);
               return FALSE;
             }
         }
diff -urNp a/plug-ins/common/file-raw.c b/plug-ins/common/file-raw.c
--- a/plug-ins/common/file-raw.c	2018-08-22 13:08:57.550276772 +0200
+++ b/plug-ins/common/file-raw.c	2018-08-22 14:43:33.061841681 +0200
@@ -632,6 +632,7 @@ save_image (const gchar  *filename,
     case RAW_RGB:
       if (! fwrite (buf, width * height * bpp, 1, fp))
         {
+          fclose (fp);
           return GIMP_PDB_EXECUTION_ERROR;
         }
 
diff -urNp a/plug-ins/common/file-tga.c b/plug-ins/common/file-tga.c
--- a/plug-ins/common/file-tga.c	2018-08-22 13:08:57.554276763 +0200
+++ b/plug-ins/common/file-tga.c	2018-08-22 14:47:22.438146098 +0200
@@ -455,6 +455,7 @@ load_image (const gchar  *filename,
         {
           g_message (_("Cannot read footer from '%s'"),
                      gimp_filename_to_utf8 (filename));
+          fclose (fp);
           return -1;
         }
       else if (memcmp (footer + 8, magic, sizeof (magic)) == 0)
@@ -473,6 +474,7 @@ load_image (const gchar  *filename,
                 {
                   g_message (_("Cannot read extension from '%s'"),
                              gimp_filename_to_utf8 (filename));
+                  fclose (fp);
                   return -1;
                 }
               /* Eventually actually handle version 2 TGA here */
@@ -485,6 +487,7 @@ load_image (const gchar  *filename,
     {
       g_message (_("Cannot read header from '%s'"),
                  gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
 
@@ -560,6 +563,7 @@ load_image (const gchar  *filename,
             g_message ("Unhandled sub-format in '%s' (type = %u, bpp = %u)",
                        gimp_filename_to_utf8 (filename),
                        info.imageType, info.bpp);
+            fclose (fp);
             return -1;
           }
         break;
@@ -575,6 +579,7 @@ load_image (const gchar  *filename,
             g_message ("Unhandled sub-format in '%s' (type = %u, bpp = %u, alpha = %u)",
                        gimp_filename_to_utf8 (filename),
                        info.imageType, info.bpp, info.alphaBits);
+            fclose (fp);
             return -1;
           }
         break;
@@ -585,6 +590,7 @@ load_image (const gchar  *filename,
             g_message ("Unhandled sub-format in '%s' (type = %u, bpp = %u)",
                        gimp_filename_to_utf8 (filename),
                        info.imageType, info.bpp);
+            fclose (fp);
             return -1;
           }
         break;
@@ -592,6 +598,7 @@ load_image (const gchar  *filename,
       default:
         g_message ("Unknown image type %u for '%s'",
                    info.imageType, gimp_filename_to_utf8 (filename));
+        fclose (fp);
         return -1;
     }
 
@@ -601,6 +608,7 @@ load_image (const gchar  *filename,
       g_message ("Unhandled sub-format in '%s' (type = %u, bpp = %u)",
                  gimp_filename_to_utf8 (filename),
                  info.imageType, info.bpp);
+      fclose (fp);
       return -1;
     }
 
@@ -609,12 +617,14 @@ load_image (const gchar  *filename,
     {
       g_message ("Indexed image has invalid color map type %u",
                  info.colorMapType);
+      fclose (fp);
       return -1;
     }
   else if (info.imageType != TGA_TYPE_MAPPED && info.colorMapType != 0)
     {
       g_message ("Non-indexed image has invalid color map type %u",
                  info.colorMapType);
+      fclose (fp);
       return -1;
     }
 
@@ -623,6 +633,7 @@ load_image (const gchar  *filename,
     {
       g_message ("File '%s' is truncated or corrupted",
                  gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
 
diff -urNp a/plug-ins/common/file-tiff-load.c b/plug-ins/common/file-tiff-load.c
--- a/plug-ins/common/file-tiff-load.c	2018-08-22 13:08:57.547276778 +0200
+++ b/plug-ins/common/file-tiff-load.c	2018-08-23 11:22:06.741725028 +0200
@@ -389,6 +389,7 @@ tiff_warning (const gchar *module,
       va_arg (ap_test, const char *); /* ignore first arg */
 
       tag  = va_arg (ap_test, int);
+      va_end(ap_test);
     }
   /* for older versions of libtiff? */
   else if (! strcmp (fmt, "unknown field with tag %d (0x%x) ignored"))
@@ -398,13 +399,14 @@ tiff_warning (const gchar *module,
       G_VA_COPY (ap_test, ap);
 
       tag = va_arg (ap_test, int);
+      va_end (ap_test);
     }
 
   /* Workaround for: http://bugzilla.gnome.org/show_bug.cgi?id=131975 */
   /* Ignore the warnings about unregistered private tags (>= 32768).  */
   if (tag >= 32768)
     return;
-
+  
   /* Other unknown fields are only reported to stderr. */
   if (tag > 0)
     {
@@ -1674,7 +1676,7 @@ read_16bit (const guchar *source,
 
             case PHOTOMETRIC_PALETTE:
               *dest++= *source; source += 2;
-              if (alpha) *dest++= *source; source += 2;
+              if (alpha) {*dest++= *source; source += 2;}
               break;
 
             case PHOTOMETRIC_RGB:
diff -urNp a/plug-ins/common/file-tiff-save.c b/plug-ins/common/file-tiff-save.c
--- a/plug-ins/common/file-tiff-save.c	2018-08-22 13:08:57.549276773 +0200
+++ b/plug-ins/common/file-tiff-save.c	2018-08-23 08:50:31.148794333 +0200
@@ -397,6 +397,7 @@ tiff_warning (const gchar *module,
       G_VA_COPY (ap_test, ap);
       if (va_arg (ap_test, char *));  /* ignore first argument */
       if (va_arg (ap_test, int) >= 32768)
+        va_end (ap_test);
         return;
     }
   /* for older versions of libtiff? */
@@ -404,6 +405,7 @@ tiff_warning (const gchar *module,
     {
       G_VA_COPY (ap_test, ap);
       if (va_arg (ap_test, int) >= 32768)
+        va_end (ap_test);
         return;
     }
 
diff -urNp a/plug-ins/common/file-xbm.c b/plug-ins/common/file-xbm.c
--- a/plug-ins/common/file-xbm.c	2018-08-22 13:08:57.549276773 +0200
+++ b/plug-ins/common/file-xbm.c	2018-08-23 08:53:29.898903030 +0200
@@ -820,6 +820,7 @@ load_image (const gchar  *filename,
     {
       g_message (_("'%s':\nCould not read header (ftell == %ld)"),
                  gimp_filename_to_utf8 (filename), ftell (fp));
+      fclose (fp);
       return -1;
     }
 
@@ -827,6 +828,7 @@ load_image (const gchar  *filename,
     {
       g_message (_("'%s':\nNo image width specified"),
                  gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
 
@@ -834,6 +836,7 @@ load_image (const gchar  *filename,
     {
       g_message (_("'%s':\nImage width is larger than GIMP can handle"),
                  gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
 
@@ -841,6 +844,7 @@ load_image (const gchar  *filename,
     {
       g_message (_("'%s':\nNo image height specified"),
                  gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
 
@@ -848,6 +852,7 @@ load_image (const gchar  *filename,
     {
       g_message (_("'%s':\nImage height is larger than GIMP can handle"),
                  gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
 
@@ -855,6 +860,7 @@ load_image (const gchar  *filename,
     {
       g_message (_("'%s':\nNo image data type specified"),
                  gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
 
diff -urNp a/plug-ins/common/file-xmc.c b/plug-ins/common/file-xmc.c
--- a/plug-ins/common/file-xmc.c	2018-08-22 13:08:57.548276776 +0200
+++ b/plug-ins/common/file-xmc.c	2018-08-23 09:07:50.336523732 +0200
@@ -889,6 +889,7 @@ load_thumbnail (const gchar *filename, g
       g_set_error (error, 0, 0,
                    _("there is no image chunk in \"%s\"."),
                    gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
 
@@ -931,6 +932,7 @@ load_thumbnail (const gchar *filename, g
       g_set_error (error, 0, 0,
                    _("'%s' is too wide for an X cursor."),
                    gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
   if (*thumb_height > MAX_LOAD_DIMENSION)
@@ -938,6 +940,7 @@ load_thumbnail (const gchar *filename, g
       g_set_error (error, 0, 0,
                    _("'%s' is too high for an X cursor."),
                    gimp_filename_to_utf8 (filename));
+      fclose (fp);
       return -1;
     }
 
@@ -1463,6 +1466,7 @@ save_image (const gchar *filename,
   if (!imagesp)
     {
       DM_XMC("Failed to XcursorImagesCreate!\n");
+      fclose (fp);
       return FALSE;
     }
   imagesp->nimage = nlayers;
@@ -1481,6 +1485,7 @@ save_image (const gchar *filename,
         {
           g_set_error (error, 0, 0,
           _("This plug-in can only handle RGBA image files with 8bit color depth."));
+          fclose (fp);
           return FALSE;
         }
       /* get framename of this layer */
@@ -1500,6 +1505,7 @@ save_image (const gchar *filename,
           g_set_error (error, 0, 0,
                        _("Frame '%s' is too wide. Please reduce to no more than %dpx."),
                        gimp_any_to_utf8 (framename, -1, NULL), MAX_SAVE_DIMENSION);
+          fclose (fp);
           return FALSE;
         }
       if (drawable->height > MAX_SAVE_DIMENSION)
@@ -1507,6 +1513,7 @@ save_image (const gchar *filename,
           g_set_error (error, 0, 0,
                        _("Frame '%s' is too high. Please reduce to no more than %dpx."),
                        gimp_any_to_utf8 (framename, -1, NULL), MAX_SAVE_DIMENSION);
+          fclose (fp);
           return FALSE;
         }
       if (drawable->height == 0 ||drawable->width == 0)
@@ -1514,6 +1521,7 @@ save_image (const gchar *filename,
           g_set_error (error, 0, 0,
                        _("Width and/or height of frame '%s' is zero!"),
                        gimp_any_to_utf8 (framename, -1, NULL));
+          fclose (fp);
           return FALSE;
         }
 
@@ -1535,6 +1543,7 @@ save_image (const gchar *filename,
               if (!imagesp->images[i])
                 {
                   DM_XMC ("Failed to XcursorImageCreate.\n");
+                  fclose (fp);
                   return FALSE;
                 }
               imagesp->images[i]->pixels[0] = 0x0;
@@ -1557,6 +1566,7 @@ save_image (const gchar *filename,
                              "Try to change the hot spot position, "
                              "layer geometry or save without auto-crop."),
                            gimp_any_to_utf8 (framename, -1, NULL));
+              fclose (fp);
               return FALSE;
             }
         }
@@ -1589,6 +1599,7 @@ save_image (const gchar *filename,
       if (!imagesp->images[i])
         {
           DM_XMC ("Failed to XcursorImageCreate.\n");
+          fclose (fp);
           return FALSE;
         }
       /*
@@ -1636,8 +1647,10 @@ save_image (const gchar *filename,
                                   imagesp->images[i]->delay,
                                   DISPLAY_DIGIT(imagesp->nimage),
                                   error);
-      if (!framename)
+      if (!framename) {
+        fclose (fp);
         return FALSE;
+      }
 
       gimp_item_set_name (orig_layers[nlayers - 1 - i], framename);
       g_free (framename);
@@ -1693,6 +1706,7 @@ save_image (const gchar *filename,
         {
           DM_XMC("Failed to XcursorFileSave.\t%p\t%p\t%p\n",
                  fp, commentsp, imagesp);
+          fclose (fp);
           return FALSE;
         }
 
@@ -1702,6 +1716,7 @@ save_image (const gchar *filename,
       if (! XcursorFileSaveImages (fp, imagesp))
         {
           DM_XMC("Failed to XcursorFileSaveImages.\t%p\t%p\n", fp, imagesp);
+          fclose (fp);
           return FALSE;
         }
     }
diff -urNp a/plug-ins/file-fli/fli-gimp.c b/plug-ins/file-fli/fli-gimp.c
--- a/plug-ins/file-fli/fli-gimp.c	2018-08-22 13:08:57.534276804 +0200
+++ b/plug-ins/file-fli/fli-gimp.c	2018-08-23 11:07:07.242096387 +0200
@@ -504,9 +504,10 @@ load_image (const gchar  *filename,
                              gimp_filename_to_utf8 (filename));
 
   fli_read_header (file, &fli_header);
-  if (fli_header.magic == NO_HEADER)
+  if (fli_header.magic == NO_HEADER) {
+    fclose (file);
     return -1;
-  else
+  } else
     fseek (file, 128, SEEK_SET);
 
   /*
@@ -528,11 +529,13 @@ load_image (const gchar  *filename,
   if (to_frame < 1)
     {
       /* nothing to do ... */
+      fclose (file);
       return -1;
     }
   if (from_frame >= fli_header.frames)
     {
       /* nothing to do ... */
+      fclose (file);
       return -1;
     }
   if (to_frame>fli_header.frames)
diff -urNp a/plug-ins/file-xjt/xjt.c b/plug-ins/file-xjt/xjt.c
--- a/plug-ins/file-xjt/xjt.c	2018-08-22 13:08:57.511276852 +0200
+++ b/plug-ins/file-xjt/xjt.c	2018-08-23 09:57:07.313113751 +0200
@@ -1899,7 +1899,8 @@ cleanup:
 
    g_free (l_dirname);
    g_free (l_prop_file);
-   g_free (l_jpg_file);
+   if(l_jpg_file)
+       g_free (l_jpg_file);
 
    return l_rc;
 }
@@ -3703,7 +3704,6 @@ load_xjt_image (const gchar  *filename,
 
   g_free (l_dirname);
   g_free (l_prop_file);
-  g_free (l_jpg_file);
 
   if (l_rc == 0)
     {
diff -urNp a/plug-ins/map-object/arcball.c b/plug-ins/map-object/arcball.c
--- a/plug-ins/map-object/arcball.c	2018-08-22 13:08:57.524276825 +0200
+++ b/plug-ins/map-object/arcball.c	2018-08-23 09:59:11.506843627 +0200
@@ -286,7 +286,7 @@ V3_Unit (HVect v)
   static HVect u = {0, 0, 0, 0};
   double vlen = sqrt(V3_Norm(v));
 
-  if (vlen != 0.0) u.x = v.x/vlen; u.y = v.y/vlen; u.z = v.z/vlen;
+  if (vlen != 0.0) {u.x = v.x/vlen; u.y = v.y/vlen; u.z = v.z/vlen;}
   return (u);
 }
 
diff -urNp a/plug-ins/metadata/interface.c b/plug-ins/metadata/interface.c
--- a/plug-ins/metadata/interface.c	2018-08-22 13:08:57.509276856 +0200
+++ b/plug-ins/metadata/interface.c	2018-08-23 10:02:02.098447725 +0200
@@ -508,6 +508,7 @@ export_dialog_response (GtkWidget *dlg,
                                    _("Some error occurred while saving"));
           g_string_free (buffer, TRUE);
           g_free (filename);
+          fclose (fd);
           return;
         }
 
diff -urNp a/plug-ins/pygimp/gimpui.override b/plug-ins/pygimp/gimpui.override
--- a/plug-ins/pygimp/gimpui.override	2018-08-22 13:08:57.521276831 +0200
+++ b/plug-ins/pygimp/gimpui.override	2018-08-23 10:03:15.642270080 +0200
@@ -1009,7 +1009,7 @@ _wrap_gimp_color_scale_new(PyGObject *se
     if (pygobject_construct(self,
                             "orientation", orientation,
                             "channel",     channel,
-                            NULL));
+                            NULL))
         return -1;
 
     gtk_range_set_flippable (GTK_RANGE (self->obj),
diff -urNp a/plug-ins/pygimp/plug-ins/whirlpinch.py b/plug-ins/pygimp/plug-ins/whirlpinch.py
--- a/plug-ins/pygimp/plug-ins/whirlpinch.py	2018-08-22 13:08:57.519276835 +0200
+++ b/plug-ins/pygimp/plug-ins/whirlpinch.py	2018-08-23 10:04:23.121104075 +0200
@@ -125,7 +125,7 @@ def whirl_pinch(image, drawable, whirl,
                                 if cx >= 0: ix = int(cx)
                                 else:       ix = -(int(-cx) + 1)
                                 if cy >= 0: iy = int(cy)
-                                else:       iy = -(int(-cx) + 1)
+                                else:       iy = -(int(-cy) + 1)
                                 pixel[0] = pft.get_pixel(ix, iy)
                                 pixel[1] = pft.get_pixel(ix+1, iy)
                                 pixel[2] = pft.get_pixel(ix, iy+1)