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



commit 6dcdbf652b6dff6f4b32ec9eb788757d17c8aa1f
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.
    
    (cherry picked from commit 31001d9f296dad9f89edaac2e58f0fba7eac7f3f)

 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 bfe9c53f7a..7e146bbd27 100644
--- a/plug-ins/common/file-raw-data.c
+++ b/plug-ins/common/file-raw-data.c
@@ -1142,6 +1142,7 @@ save_image (GFile         *file,
     case RAW_RGB:
       if (! fwrite (buf, width * height * bpp, 1, fp))
         {
+          fclose (fp);
           return FALSE;
         }
 
@@ -1213,6 +1214,7 @@ save_image (GFile         *file,
       break;
 
     default:
+      fclose (fp);
       break;
     }
 


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