diff --git a/modules/gimpinputdevicestore-dx.c b/modules/gimpinputdevicestore-dx.c index a428f99b9b..2917f012b4 100644 --- a/modules/gimpinputdevicestore-dx.c +++ b/modules/gimpinputdevicestore-dx.c @@ -366,7 +366,10 @@ gimp_input_device_store_add (GimpInputDeviceStore *store, guid, &didevice8, NULL)))) - return FALSE; + { + g_free (guidstring); + return FALSE; + } if (FAILED ((hresult = IDirectInputDevice8_SetCooperativeLevel (didevice8, (HWND) gdk_win32_drawable_get_handle (store->window), @@ -374,6 +377,7 @@ gimp_input_device_store_add (GimpInputDeviceStore *store, { g_warning ("IDirectInputDevice8::SetCooperativeLevel failed: %s", g_win32_error_message (hresult)); + g_free (guidstring); return FALSE; } @@ -383,6 +387,7 @@ gimp_input_device_store_add (GimpInputDeviceStore *store, { g_warning ("IDirectInputDevice8::GetDeviceInfo failed: %s", g_win32_error_message (hresult)); + g_free (guidstring); return FALSE; } diff --git a/plug-ins/common/crop-zealous.c b/plug-ins/common/crop-zealous.c index 196001282f..409603b550 100644 --- a/plug-ins/common/crop-zealous.c +++ b/plug-ins/common/crop-zealous.c @@ -236,6 +236,8 @@ do_zcrop (GimpDrawable *drawable, (livingcols == width && livingrows == height)) { g_message (_("Nothing to crop.")); + g_free (killrows); + g_free (killcols); return; } diff --git a/plug-ins/common/curve-bend.c b/plug-ins/common/curve-bend.c index da67755f36..1abb23562f 100644 --- a/plug-ins/common/curve-bend.c +++ b/plug-ins/common/curve-bend.c @@ -900,6 +900,7 @@ p_load_pointfile (BenderDialog *cd, { g_message (_("Error while reading '%s': %s"), gimp_filename_to_utf8 (filename), g_strerror (errno)); + fclose (l_fp); return -1; } diff --git a/plug-ins/common/file-cel.c b/plug-ins/common/file-cel.c index 040a8c8573..8118aab246 100644 --- a/plug-ins/common/file-cel.c +++ b/plug-ins/common/file-cel.c @@ -351,6 +351,7 @@ load_image (const gchar *file, if (image == -1) { g_message (_("Can't create a new image")); + fclose (fp); return -1; } diff --git a/plug-ins/common/file-compressor.c b/plug-ins/common/file-compressor.c index 72eee036ee..44d5ab218f 100644 --- a/plug-ins/common/file-compressor.c +++ b/plug-ins/common/file-compressor.c @@ -601,6 +601,7 @@ load_image (const Compressor *compressor, g_unlink (tmpname); g_free (tmpname); + fclose (f); *status = GIMP_PDB_EXECUTION_ERROR; return -1; diff --git a/plug-ins/common/file-csource.c b/plug-ins/common/file-csource.c index aade8310d9..f3b18c8226 100644 --- a/plug-ins/common/file-csource.c +++ b/plug-ins/common/file-csource.c @@ -654,6 +654,7 @@ save_image (Config *config, break; default: g_warning ("unhandled drawable type (%d)", drawable_type); + fclose (fp); return FALSE; } if (!config->use_macros) diff --git a/plug-ins/common/file-dicom.c b/plug-ins/common/file-dicom.c index 92d9dd262e..d4fbe8f29a 100644 --- a/plug-ins/common/file-dicom.c +++ b/plug-ins/common/file-dicom.c @@ -356,6 +356,8 @@ load_image (const gchar *filename, g_message ("'%s' is a PAPYRUS DICOM file.\n" "This plug-in does not support this type yet.", gimp_filename_to_utf8 (filename)); + g_free (dicominfo); + fclose (DICOM); return -1; } @@ -365,6 +367,8 @@ load_image (const gchar *filename, g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("'%s' is not a DICOM file."), gimp_filename_to_utf8 (filename)); + g_free (dicominfo); + fclose (DICOM); return -1; } diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c index e9ce57e859..805b0b2e9d 100644 --- a/plug-ins/common/file-gbr.c +++ b/plug-ins/common/file-gbr.c @@ -578,6 +578,7 @@ load_image (const gchar *filename, g_message ("Unsupported brush depth: %d\n" "GIMP Brushes must be GRAY or RGBA\n", bh.bytes); + g_free (name); return -1; } diff --git a/plug-ins/common/file-gih.c b/plug-ins/common/file-gih.c index 4c6cbd6a82..d5eb25746d 100644 --- a/plug-ins/common/file-gih.c +++ b/plug-ins/common/file-gih.c @@ -575,6 +575,7 @@ gih_load_one_brush (gint fd, g_message ("Unsupported brush depth: %d\n" "GIMP Brushes must be GRAY or RGBA\n", bh.bytes); + g_free (name); return FALSE; } diff --git a/plug-ins/common/file-header.c b/plug-ins/common/file-header.c index 583a1231e7..983b526f67 100644 --- a/plug-ins/common/file-header.c +++ b/plug-ins/common/file-header.c @@ -290,6 +290,8 @@ save_image (const gchar *filename, default: g_warning ("unhandled drawable type (%d)", drawable_type); + fclose (fp); + g_free (data); return FALSE; } diff --git a/plug-ins/common/file-html-table.c b/plug-ins/common/file-html-table.c index dd7e03fd7a..e60a02ba92 100644 --- a/plug-ins/common/file-html-table.c +++ b/plug-ins/common/file-html-table.c @@ -234,6 +234,7 @@ save_image (const gchar *filename, g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), _("Could not open '%s' for writing: %s"), gimp_filename_to_utf8 (filename), g_strerror (errno)); + g_free (palloc); return FALSE; } diff --git a/plug-ins/common/file-pcx.c b/plug-ins/common/file-pcx.c index 51c6479422..57cd29a022 100644 --- a/plug-ins/common/file-pcx.c +++ b/plug-ins/common/file-pcx.c @@ -370,6 +370,7 @@ load_image (const gchar *filename, g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Could not read header from '%s'"), gimp_filename_to_utf8 (filename)); + fclose (fd); return -1; } @@ -380,6 +381,7 @@ load_image (const gchar *filename, g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("'%s' is not a PCX file"), gimp_filename_to_utf8 (filename)); + fclose (fd); return -1; } @@ -392,16 +394,19 @@ load_image (const gchar *filename, if ((width < 0) || (width > GIMP_MAX_IMAGE_SIZE)) { g_message (_("Unsupported or invalid image width: %d"), width); + fclose (fd); return -1; } if ((height < 0) || (height > GIMP_MAX_IMAGE_SIZE)) { g_message (_("Unsupported or invalid image height: %d"), height); + fclose (fd); return -1; } if (bytesperline < (width * pcx_header.bpp) / 8) { g_message (_("Invalid number of bytes per line in PCX header")); + fclose (fd); return -1; } @@ -409,6 +414,7 @@ load_image (const gchar *filename, if (G_MAXSIZE / width / height < 3) { g_message (_("Image dimensions too large: width %d x height %d"), width, height); + fclose (fd); return -1; } @@ -457,12 +463,14 @@ load_image (const gchar *filename, else { g_message (_("Unusual PCX flavour, giving up")); + fclose (fd); return -1; } gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, TRUE, FALSE); gimp_pixel_rgn_set_rect (&pixel_rgn, dest, 0, 0, width, height); + fclose (fd); g_free (dest); gimp_drawable_flush (drawable); diff --git a/plug-ins/common/file-psp.c b/plug-ins/common/file-psp.c index da53903760..ef39d5b847 100644 --- a/plug-ins/common/file-psp.c +++ b/plug-ins/common/file-psp.c @@ -886,6 +886,7 @@ read_creator_block (FILE *f, if (fread (string, length, 1, f) < 1) { g_message ("Error reading creator keyword data"); + g_free (string); return -1; } switch (keyword) diff --git a/plug-ins/common/file-sunras.c b/plug-ins/common/file-sunras.c index d0784a12f1..fce0164a3e 100644 --- a/plug-ins/common/file-sunras.c +++ b/plug-ins/common/file-sunras.c @@ -440,6 +440,7 @@ load_image (const gchar *filename, g_message (_("Could not read color entries from '%s'"), gimp_filename_to_utf8 (filename)); fclose (ifp); + g_free (suncolmap); return (-1); } } diff --git a/plug-ins/common/file-xwd.c b/plug-ins/common/file-xwd.c index dd758ebf19..00f5d98d9f 100644 --- a/plug-ins/common/file-xwd.c +++ b/plug-ins/common/file-xwd.c @@ -487,6 +487,7 @@ load_image (const gchar *filename, { g_message (_("'%s':\nNo image width specified"), gimp_filename_to_utf8 (filename)); + g_free (xwdcolmap); fclose (ifp); return (-1); } @@ -496,6 +497,7 @@ load_image (const gchar *filename, { g_message (_("'%s':\nImage width is larger than GIMP can handle"), gimp_filename_to_utf8 (filename)); + g_free (xwdcolmap); fclose (ifp); return (-1); } @@ -504,6 +506,7 @@ load_image (const gchar *filename, { g_message (_("'%s':\nNo image height specified"), gimp_filename_to_utf8 (filename)); + g_free (xwdcolmap); fclose (ifp); return (-1); } @@ -512,6 +515,7 @@ load_image (const gchar *filename, { g_message (_("'%s':\nImage height is larger than GIMP can handle"), gimp_filename_to_utf8 (filename)); + g_free (xwdcolmap); fclose (ifp); return (-1); } diff --git a/plug-ins/common/mail.c b/plug-ins/common/mail.c index 5e09eb7e55..61f3c4facc 100644 --- a/plug-ins/common/mail.c +++ b/plug-ins/common/mail.c @@ -606,6 +606,8 @@ find_extension (const gchar *filename) } } + g_free (filename_copy); + return ext; } diff --git a/plug-ins/file-bmp/bmp-read.c b/plug-ins/file-bmp/bmp-read.c index f72e6b747c..59a1dfadff 100644 --- a/plug-ins/file-bmp/bmp-read.c +++ b/plug-ins/file-bmp/bmp-read.c @@ -170,6 +170,7 @@ ReadBMP (const gchar *name, g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("'%s' is not a valid BMP file"), gimp_filename_to_utf8 (filename)); + fclose (fd); return -1; } diff --git a/plug-ins/file-ico/ico-save.c b/plug-ins/file-ico/ico-save.c index fe460b8af6..fbcfd7966b 100644 --- a/plug-ins/file-ico/ico-save.c +++ b/plug-ins/file-ico/ico-save.c @@ -1025,6 +1025,7 @@ ico_save_image (const gchar *filename, if (fwrite (entries, sizeof (IcoFileEntry), info.num_icons, fp) <= 0) { ico_save_info_free (&info); + g_free (entries); fclose (fp); return GIMP_PDB_EXECUTION_ERROR; } diff --git a/plug-ins/file-psd/psd-image-res-load.c b/plug-ins/file-psd/psd-image-res-load.c index 945c876fb0..3dd53dc37c 100644 --- a/plug-ins/file-psd/psd-image-res-load.c +++ b/plug-ins/file-psd/psd-image-res-load.c @@ -437,6 +437,7 @@ load_resource_unknown (const PSDimageres *res_a, if (fread (data, res_a->data_len, 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (data); return -1; } @@ -471,6 +472,7 @@ load_resource_ps_only (const PSDimageres *res_a, if (fread (data, res_a->data_len, 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (data); return -1; } @@ -800,6 +802,7 @@ load_resource_1028 (const PSDimageres *res_a, if (fread (res_data, res_a->data_len, 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (res_data); return -1; } @@ -1067,6 +1070,7 @@ load_resource_1039 (const PSDimageres *res_a, if (fread (icc_profile, res_a->data_len, 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (icc_profile); return -1; } @@ -1226,6 +1230,7 @@ load_resource_1058 (const PSDimageres *res_a, if (fread (res_data, res_a->data_len, 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (res_data); return -1; } @@ -1336,6 +1341,7 @@ load_resource_1060 (const PSDimageres *res_a, if (fread (res_data, res_a->data_len, 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (res_data); return -1; } /* Null terminate metadata block for decode procedure */ @@ -1472,6 +1478,7 @@ load_resource_2000 (const PSDimageres *res_a, if (fseek (f, 22, SEEK_CUR) < 0) { psd_set_error (feof (f), errno, error); + g_free (controlpoints); return -1; } diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c index edfd30b81d..0071a400c9 100644 --- a/plug-ins/file-psd/psd-load.c +++ b/plug-ins/file-psd/psd-load.c @@ -1181,6 +1181,7 @@ add_layers (const gint32 image_id, if (fread (&rle_pack_len[rowi], 2, 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (rle_pack_len); return -1; } rle_pack_len[rowi] = GUINT16_FROM_BE (rle_pack_len[rowi]); @@ -1846,6 +1847,8 @@ read_channel_data (PSDchannel *channel, if (fread (src, rle_pack_len[i], 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (src); + g_free (dst); return -1; } /* FIXME check for errors returned from decode packbits */ diff --git a/plug-ins/file-psd/psd-util.c b/plug-ins/file-psd/psd-util.c index 619189c5e2..cc45110a6e 100644 --- a/plug-ins/file-psd/psd-util.c +++ b/plug-ins/file-psd/psd-util.c @@ -102,6 +102,7 @@ fread_pascal_string (gint32 *bytes_read, if (fread (str, len, 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (str); return NULL; } *bytes_read += len; @@ -247,6 +248,7 @@ fread_unicode_string (gint32 *bytes_read, if (fread (&utf16_str[i], 2, 1, f) < 1) { psd_set_error (feof (f), errno, error); + g_free (utf16_str); return NULL; } *bytes_read += 2; diff --git a/plug-ins/fractal-explorer/fractal-explorer-dialogs.c b/plug-ins/fractal-explorer/fractal-explorer-dialogs.c index 5fbc1f98a8..60bb99ff28 100644 --- a/plug-ins/fractal-explorer/fractal-explorer-dialogs.c +++ b/plug-ins/fractal-explorer/fractal-explorer-dialogs.c @@ -1869,12 +1869,14 @@ explorer_load (void) { g_message (_("'%s' is not a FractalExplorer file"), gimp_filename_to_utf8 (filename)); + fclose (fp); return; } if (load_options (current_obj,fp)) { g_message (_("'%s' is corrupt. Line %d Option section incorrect"), gimp_filename_to_utf8 (filename), line_no); + fclose (fp); return; } diff --git a/plug-ins/fractal-explorer/fractal-explorer.c b/plug-ins/fractal-explorer/fractal-explorer.c index 5d1eca21d1..9c75a1f51c 100644 --- a/plug-ins/fractal-explorer/fractal-explorer.c +++ b/plug-ins/fractal-explorer/fractal-explorer.c @@ -949,6 +949,7 @@ fractalexplorer_load (const gchar *filename, g_message (_("File '%s' is not a FractalExplorer file"), gimp_filename_to_utf8 (filename)); fclose (fp); + fractalexplorer_free (fractalexplorer); return NULL; } @@ -958,6 +959,7 @@ fractalexplorer_load (const gchar *filename, g_message (_("File '%s' is corrupt.\nLine %d Option section incorrect"), gimp_filename_to_utf8 (filename), line_no); fclose (fp); + fractalexplorer_free (fractalexplorer); return NULL; } diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index 7ff8520f5e..d2f5ce96e4 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -456,6 +456,7 @@ gfig_load (const gchar *filename, { g_message ("File '%s' is not a gfig file", gimp_filename_to_utf8 (gfig->filename)); + gfig_free (gfig); return NULL; } @@ -475,6 +476,7 @@ gfig_load (const gchar *filename, { g_message ("File '%s' corrupt file - Line %d Option section incorrect", gimp_filename_to_utf8 (filename), line_no); + gfig_free (gfig); return NULL; } @@ -482,6 +484,7 @@ gfig_load (const gchar *filename, { g_message ("File '%s' corrupt file - Line %d Option section incorrect", gimp_filename_to_utf8 (filename), line_no); + gfig_free (gfig); return NULL; } @@ -497,6 +500,7 @@ gfig_load (const gchar *filename, { g_message ("File '%s' corrupt file - Line %d Object count to small", gimp_filename_to_utf8 (filename), line_no); + gfig_free (gfig); return NULL; } diff --git a/plug-ins/gimpressionist/ppmtool.c b/plug-ins/gimpressionist/ppmtool.c index 5c8a68fac4..8af3fcdc18 100644 --- a/plug-ins/gimpressionist/ppmtool.c +++ b/plug-ins/gimpressionist/ppmtool.c @@ -339,6 +339,7 @@ ppm_load (const char *fn, ppm_t *p) readline (f, line, 200); if (strcmp (line, "255")) { + fclose (f); g_printerr ("ppm_load: File \"%s\" not valid PPM/PGM? (line=\"%s\")%c\n", gimp_filename_to_utf8 (fn), line, 7); ppm_new (p, 10,10); diff --git a/plug-ins/ifs-compose/ifs-compose-utils.c b/plug-ins/ifs-compose/ifs-compose-utils.c index 4e2a355159..be61eec519 100644 --- a/plug-ins/ifs-compose/ifs-compose-utils.c +++ b/plug-ins/ifs-compose/ifs-compose-utils.c @@ -264,6 +264,7 @@ ipolygon_convex_hull (IPolygon *poly) { memcpy (new_points, poly->points, num_new * sizeof (GdkPoint)); new_poly->npoints = num_new; + g_free (sort_points); return new_poly; }