[gegl] Fix newly introduced memory leaks from GeglMatrix type change



commit d5ed2b9533daa998de291a6241a1d5f080852dbd
Author: Jon Nordby <jononor gmail com>
Date:   Sat Apr 9 14:40:31 2011 +0200

    Fix newly introduced memory leaks from GeglMatrix type change
    
    Introduced in ffe0549a8c64172c28fe16b8c48d1ee967b87b99
    https://bugzilla.gnome.org/show_bug.cgi?id=645817#c3

 operations/affine/affine.c          |   13 ++++++-------
 operations/external/path.c          |    6 +++---
 operations/external/vector-fill.c   |    6 +++---
 operations/external/vector-stroke.c |    6 +++---
 4 files changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/operations/affine/affine.c b/operations/affine/affine.c
index 271cae8..8992aed 100644
--- a/operations/affine/affine.c
+++ b/operations/affine/affine.c
@@ -681,7 +681,7 @@ affine_generic (GeglBuffer  *dest,
   gfloat * restrict     dest_buf,
                        *dest_ptr;
   GeglMatrix3           inverse;
-  GeglMatrix2          *inverse_jacobian;
+  GeglMatrix2           inverse_jacobian;
   gdouble               u_start,
                         v_start,
                         u_float,
@@ -692,7 +692,6 @@ affine_generic (GeglBuffer  *dest,
   gint                  dest_pixels;
 
   format = babl_format ("RaGaBaA float");
-  inverse_jacobian = g_new(GeglMatrix2, 1);  
 
   /* XXX: fast paths as existing in files in the same dir as affine.c
    *      should probably be hooked in here, and bailing out before using
@@ -710,13 +709,13 @@ affine_generic (GeglBuffer  *dest,
 
       gegl_matrix3_copy_into (&inverse, matrix);
       gegl_matrix3_invert (&inverse);
-      inverse_jacobian->coeff[0][0] = inverse.coeff[0][0];
-      inverse_jacobian->coeff[0][1] = inverse.coeff[0][1];
-      inverse_jacobian->coeff[1][0] = inverse.coeff[1][0];
-      inverse_jacobian->coeff[1][1] = inverse.coeff[1][1];
+      inverse_jacobian.coeff[0][0] = inverse.coeff[0][0];
+      inverse_jacobian.coeff[0][1] = inverse.coeff[0][1];
+      inverse_jacobian.coeff[1][0] = inverse.coeff[1][0];
+      inverse_jacobian.coeff[1][1] = inverse.coeff[1][1];
 
      /* set inverse_jacobian for samplers that support it */
-      sampler->inverse_jacobian = inverse_jacobian;
+      sampler->inverse_jacobian = &inverse_jacobian;
 
       u_start = inverse.coeff[0][0] * roi->x + inverse.coeff[0][1]
                     * roi->y + inverse.coeff[0][2];
diff --git a/operations/external/path.c b/operations/external/path.c
index 64adb32..36c5b6a 100644
--- a/operations/external/path.c
+++ b/operations/external/path.c
@@ -100,9 +100,9 @@ prepare (GeglOperation *operation)
   gegl_operation_set_format (operation, "output", babl_format ("RaGaBaA float"));
   if (o->transform && o->transform[0] != '\0')
     {
-      GeglMatrix3 *matrix = gegl_matrix3_new();
-      gegl_matrix3_parse_string (matrix, o->transform);
-      gegl_path_set_matrix (o->d, matrix);
+      GeglMatrix3 matrix;
+      gegl_matrix3_parse_string (&matrix, o->transform);
+      gegl_path_set_matrix (o->d, &matrix);
     }
 }
 
diff --git a/operations/external/vector-fill.c b/operations/external/vector-fill.c
index 695950c..df81d78 100644
--- a/operations/external/vector-fill.c
+++ b/operations/external/vector-fill.c
@@ -79,9 +79,9 @@ prepare (GeglOperation *operation)
   gegl_operation_set_format (operation, "output", babl_format ("RaGaBaA float"));
   if (o->transform && o->transform[0] != '\0')
     {
-      GeglMatrix3 *matrix = gegl_matrix3_new ();
-      gegl_matrix3_parse_string (matrix, o->transform);
-      gegl_path_set_matrix (o->d, matrix);
+      GeglMatrix3 matrix;
+      gegl_matrix3_parse_string (&matrix, o->transform);
+      gegl_path_set_matrix (o->d, &matrix);
     }
 }
 
diff --git a/operations/external/vector-stroke.c b/operations/external/vector-stroke.c
index b26aeac..08330f6 100644
--- a/operations/external/vector-stroke.c
+++ b/operations/external/vector-stroke.c
@@ -78,9 +78,9 @@ prepare (GeglOperation *operation)
   gegl_operation_set_format (operation, "output", babl_format ("RaGaBaA float"));
   if (o->transform && o->transform[0] != '\0')
     {
-      GeglMatrix3 *matrix = gegl_matrix3_new ();
-      gegl_matrix3_parse_string (matrix, o->transform);
-      gegl_path_set_matrix (o->d, matrix);
+      GeglMatrix3 matrix;
+      gegl_matrix3_parse_string (&matrix, o->transform);
+      gegl_path_set_matrix (o->d, &matrix);
     }
 }
 



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