plug-ins: The plugin can leak the "tif" file descriptor as written...

... and also doesn't write out all the data, if it does a "goto out" for
any reason. A leaked file descriptor can prevent a file from being
renamed or deleted on Windows.
See also #3740.

Reviewer note (Jehan): this may not be the main issue as reporters were
not writing about export failure. So there is probably another case even
when the plug-in successfully wrote the TIFF image.
This commit is contained in:
Liam Quin 2020-09-27 01:07:24 +02:00 committed by Jehan
parent 9f385b287f
commit fe340c822a
1 changed files with 4 additions and 4 deletions

View File

@ -947,7 +947,7 @@ save_image (GFile *file,
GimpMetadata *metadata,
GError **error)
{
TIFF *tif;
TIFF *tif = NULL;
const Babl *space = NULL;
gboolean status = FALSE;
gboolean out_linear = FALSE;
@ -1133,6 +1133,9 @@ save_image (GFile *file,
}
}
status = TRUE;
out:
/* close the file for good */
if (tif)
{
@ -1142,9 +1145,6 @@ save_image (GFile *file,
gimp_progress_update (1.0);
status = TRUE;
out:
g_list_free (layers);
return status;
}