[gimp/gimp-2-10] CID 228166: Resource leak in file-raw-data.c



commit 31001d9f296dad9f89edaac2e58f0fba7eac7f3f
Author: Sabri Ünal <libreajans gmail com>
Date:   Sat Oct 19 21:29:18 2019 +0000

    CID 228166: Resource leak in file-raw-data.c
    
    Overwriting fp in fp = fopen(newfile, "wb") leaks the storage that fp points to.

 plug-ins/common/file-raw-data.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/plug-ins/common/file-raw-data.c b/plug-ins/common/file-raw-data.c
index b5bad3d8e1..3d2daaddca 100644
--- a/plug-ins/common/file-raw-data.c
+++ b/plug-ins/common/file-raw-data.c
@@ -1201,6 +1201,7 @@ save_image (const gchar  *filename,
     case RAW_RGB:
       if (! fwrite (buf, width * height * bpp, 1, fp))
         {
+          fclose (fp);
           return FALSE;
         }
 
@@ -1271,6 +1272,7 @@ save_image (const gchar  *filename,
       break;
 
     default:
+      fclose (fp);
       break;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]