[mutter/gnome-42] pointer-constraints/native: Fix borders array memory leaks



commit 51b4faf7b1336376321763744acad7de367c428c
Author: Sebastian Keller <skeller gnome org>
Date:   Wed Jul 6 18:45:07 2022 +0200

    pointer-constraints/native: Fix borders array memory leaks
    
    The borders arrays were not (fully) freed when going out of scope.
    
    Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2337
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2497>
    (cherry picked from commit fe0a383d6ffc47d5a29376b392c8f2afc51dc588)

 src/backends/native/meta-pointer-constraint-native.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/native/meta-pointer-constraint-native.c 
b/src/backends/native/meta-pointer-constraint-native.c
index 6a1c066ade..0e347d9457 100644
--- a/src/backends/native/meta-pointer-constraint-native.c
+++ b/src/backends/native/meta-pointer-constraint-native.c
@@ -469,7 +469,7 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
   MetaPointerConstraintImplNative *constraint_impl_native;
   cairo_region_t *region;
   float x, y;
-  GArray *borders;
+  g_autoptr (GArray) borders = NULL;
   MetaLine2 motion;
   MetaBorder *closest_border;
   uint32_t directions;
@@ -527,7 +527,6 @@ meta_pointer_constraint_impl_native_constraint (MetaPointerConstraintImpl *const
 
   *x_inout = motion.b.x;
   *y_inout = motion.b.y;
-  g_array_free (borders, FALSE);
 }
 
 static float
@@ -616,7 +615,7 @@ meta_pointer_constraint_impl_native_ensure_constrained (MetaPointerConstraintImp
 
   if (!cairo_region_contains_point (region, (int) x, (int) y))
     {
-      GArray *borders;
+      g_autoptr (GArray) borders = NULL;
       float closest_distance_2 = FLT_MAX;
       MetaBorder *closest_border = NULL;
       ClutterSeat *seat;


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