mirror of https://github.com/GNOME/gimp.git
Fix memory and descriptor leaks
This commit is contained in:
parent
e4532fe2a8
commit
7666e5cf36
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -236,6 +236,8 @@ do_zcrop (GimpDrawable *drawable,
|
|||
(livingcols == width && livingrows == height))
|
||||
{
|
||||
g_message (_("Nothing to crop."));
|
||||
g_free (killrows);
|
||||
g_free (killcols);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -351,6 +351,7 @@ load_image (const gchar *file,
|
|||
if (image == -1)
|
||||
{
|
||||
g_message (_("Can't create a new image"));
|
||||
fclose (fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -601,6 +601,7 @@ load_image (const Compressor *compressor,
|
|||
|
||||
g_unlink (tmpname);
|
||||
g_free (tmpname);
|
||||
fclose (f);
|
||||
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -606,6 +606,8 @@ find_extension (const gchar *filename)
|
|||
}
|
||||
}
|
||||
|
||||
g_free (filename_copy);
|
||||
|
||||
return ext;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue