[gimp] plug-ins: fix a memory leak in file-png



commit 14bb38da3ff18aef87d14c2a704ba811d9a0c70c
Author: Michael Henning <drawoc darkrefraction com>
Date:   Mon Jan 14 17:36:43 2013 -0500

    plug-ins: fix a memory leak in file-png
    
    Found using clang's scan-build.

 plug-ins/common/file-png.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index d19f63f..e47c639 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -1868,7 +1868,9 @@ respin_cmap (png_structp   pp,
    */
   if (colors == 0)
     {
-      before = g_new0 (guchar, 3);
+      before = g_newa (guchar, 3);
+      memset (before, 0, sizeof (guchar) * 3);
+
       colors = 1;
     }
 



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