diff options
author | Victor Kareh <[email protected]> | 2019-05-22 11:20:31 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-06-16 18:12:44 +0200 |
commit | 4a0299e379d32bc57b8f4fa7b05f0722d4d2d3f6 (patch) | |
tree | 3ef3eec15674f50c8a12352436601fbdd1683126 /src/core | |
parent | 193df67ba85ca5d360bed388be0a340bd3814c47 (diff) | |
download | marco-4a0299e379d32bc57b8f4fa7b05f0722d4d2d3f6.tar.bz2 marco-4a0299e379d32bc57b8f4fa7b05f0722d4d2d3f6.tar.xz |
constraints: fix mem leak in meta_window_constrain()
MetaFrameBorders leaked when orig_borders != NULL and
window->fullscreen == TRUE
https://bugzilla.gnome.org/show_bug.cgi?id=679153
upstream commit:
https://gitlab.gnome.org/GNOME/metacity/commit/7e7f25f4
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/constraints.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/constraints.c b/src/core/constraints.c index 8f7e0d7e..c886d927 100644 --- a/src/core/constraints.c +++ b/src/core/constraints.c @@ -118,6 +118,7 @@ typedef struct MetaRectangle orig; MetaRectangle current; MetaFrameBorders *borders; + gboolean must_free_borders; ActionType action_type; gboolean is_user_action; @@ -339,7 +340,7 @@ meta_window_constrain (MetaWindow *window, * not gobject-style--gobject would be more pain than it's worth) or * smart pointers would be so much nicer here. *shrug* */ - if (!orig_borders) + if (info.must_free_borders) g_free (info.borders); } @@ -360,9 +361,15 @@ setup_constraint_info (ConstraintInfo *info, /* Create a fake frame geometry if none really exists */ if (orig_borders && !window->fullscreen) - info->borders = orig_borders; + { + info->borders = orig_borders; + info->must_free_borders = FALSE; + } else - info->borders = g_new0 (MetaFrameBorders, 1); + { + info->borders = g_new0 (MetaFrameBorders, 1); + info->must_free_borders = TRUE; + } if (flags & META_IS_MOVE_ACTION && flags & META_IS_RESIZE_ACTION) info->action_type = ACTION_MOVE_AND_RESIZE; |