1
0
Fork 0

tests/mtk/region: Fix MtkRectangle leak

`mtk_rectangle_new()` allocates the object dynamically,
but in the "contains-point" test case the allocated object
was not freed. Fix that by creating the object on the stack.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3679>
This commit is contained in:
Barnabás Pőcze 2024-03-30 00:19:15 +01:00 committed by Marge Bot
parent 22689d722a
commit c0ae617b3f

View file

@ -26,7 +26,7 @@ test_contains_point (void)
{
g_autoptr (MtkRegion) r1 = NULL;
r1 = mtk_region_create_rectangle (mtk_rectangle_new (0, 0, 100, 100));
r1 = mtk_region_create_rectangle (&MTK_RECTANGLE_INIT (0, 0, 100, 100));
g_assert (!mtk_region_contains_point (r1, 200, 200));
g_assert (mtk_region_contains_point (r1, 50, 50));