[gimp/gimp-2-10] plug-ins: The plugin can leak the "tif" file descriptor as written...
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: The plugin can leak the "tif" file descriptor as written...
- Date: Sat, 26 Sep 2020 23:37:29 +0000 (UTC)
commit 761e93a49e0c378f996c65edb5f3f4a62b9acdcb
Author: Liam Quin <liam fromoldbooks org>
Date: Sun Sep 27 01:07:24 2020 +0200
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.
(cherry picked from commit fe340c822af1cedf4377c49dcde8e04de839dc4a)
plug-ins/file-tiff/file-tiff-save.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/file-tiff/file-tiff-save.c b/plug-ins/file-tiff/file-tiff-save.c
index 9fe13078f6..14e2f471cb 100644
--- a/plug-ins/file-tiff/file-tiff-save.c
+++ b/plug-ins/file-tiff/file-tiff-save.c
@@ -947,7 +947,7 @@ save_image (GFile *file,
GimpMetadataSaveFlags metadata_flags,
GError **error)
{
- TIFF *tif;
+ TIFF *tif = NULL;
gboolean status = FALSE;
gboolean out_linear = FALSE;
gint number_of_sub_IFDs = 1;
@@ -1109,6 +1109,9 @@ save_image (GFile *file,
}
}
+ status = TRUE;
+
+out:
/* close the file for good */
if (tif)
{
@@ -1118,9 +1121,6 @@ save_image (GFile *file,
gimp_progress_update (1.0);
- status = TRUE;
-
-out:
return status;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]