[gimp] plug-ins: fix memory leak in psd-save



commit 0f6044ef2bb442bff8c104bd28068051493f9faf
Author: Michael Henning <drawoc darkrefraction com>
Date:   Tue Jan 15 17:10:33 2013 -0500

    plug-ins: fix memory leak in psd-save
    
    Found using clang's scan-build.

 plug-ins/file-psd/psd-save.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-save.c b/plug-ins/file-psd/psd-save.c
index 2103fee..9b30ce1 100644
--- a/plug-ins/file-psd/psd-save.c
+++ b/plug-ins/file-psd/psd-save.c
@@ -1065,7 +1065,7 @@ save_layer_and_mask (FILE   *fd,
 
   /* Create first array dimension (layers, channels) */
 
-  ChannelLengthPos = g_new (glong *, PSDImageData.nLayers);
+  ChannelLengthPos = g_newa (glong *, PSDImageData.nLayers);
 
   /* Layer and mask information section */
 
@@ -1233,6 +1233,7 @@ save_layer_and_mask (FILE   *fd,
     {
       IFDBG printf ("\t\tWriting pixel data for layer slot %d\n", i);
       write_pixel_data(fd, PSDImageData.lLayers[i], ChannelLengthPos[i], 0);
+      g_free (ChannelLengthPos[i]);
     }
 
   eof_pos = ftell (fd);



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