From fe0a383d6ffc47d5a29376b392c8f2afc51dc588 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Wed, 6 Jul 2022 18:45:07 +0200 Subject: [PATCH] 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: --- 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 199200673..eec237c72 100644 --- a/src/backends/native/meta-pointer-constraint-native.c +++ b/src/backends/native/meta-pointer-constraint-native.c @@ -455,7 +455,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; @@ -518,7 +518,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 @@ -607,7 +606,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;