[gegl] oilify: Fix invalid free (bug 729934)



commit 8f27e365a70f35de8674ae30dfdf0866edcfdef2
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Sat May 10 16:21:10 2014 -0700

    oilify: Fix invalid free (bug 729934)
    
    Prior version used n_pixels in a call to g_slice_free1 after it
    was no longer valid.

 operations/common/oilify.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/operations/common/oilify.c b/operations/common/oilify.c
index 127f5e8..b0f5b01 100644
--- a/operations/common/oilify.c
+++ b/operations/common/oilify.c
@@ -409,10 +409,10 @@ process (GeglOperation       *operation,
 
   total_pixels = src_rect.width * src_rect.height;
 
-  src_buf = g_slice_alloc (4 * total_pixels * sizeof (gfloat));
-  dst_buf = g_slice_alloc (4 * n_pixels * sizeof (gfloat));
+  src_buf = gegl_malloc (4 * total_pixels * sizeof (gfloat));
+  dst_buf = gegl_malloc (4 * n_pixels * sizeof (gfloat));
   if (o->use_inten)
-    inten_buf = g_slice_alloc (total_pixels * sizeof (gfloat));
+    inten_buf = gegl_malloc (total_pixels * sizeof (gfloat));
   else
     inten_buf = NULL;
 
@@ -448,10 +448,10 @@ process (GeglOperation       *operation,
   gegl_buffer_set (output, result, 0,
                    babl_format ("RGBA float"),
                    dst_buf, GEGL_AUTO_ROWSTRIDE);
-  g_slice_free1 (4 * total_pixels * sizeof (gfloat), src_buf);
-  g_slice_free1 (4 * n_pixels * sizeof (gfloat), dst_buf);
+  gegl_free (src_buf);
+  gegl_free (dst_buf);
   if (inten_buf)
-    g_slice_free1 (total_pixels * sizeof (gfloat), inten_buf);
+    gegl_free (inten_buf);
 
   return  TRUE;
 }


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