diff options
author | Pavel Vasin <rat4vier@gmail.com> | 2012-06-29 13:20:08 +0400 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2015-01-19 05:08:31 +0200 |
commit | 7e7f25f40ce3b15cbc63d6e8743215e287f08710 (patch) | |
tree | d6e4b3ea836d69e20c35fc849de5074c42bce512 | |
parent | 79384de0219dbc3b4b489dcde6d8570d400891ba (diff) | |
download | metacity-7e7f25f40ce3b15cbc63d6e8743215e287f08710.tar.gz |
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
-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 b93f42ea..a4621848 100644 --- a/src/core/constraints.c +++ b/src/core/constraints.c @@ -116,6 +116,7 @@ typedef struct MetaRectangle orig; MetaRectangle current; MetaFrameBorders *borders; + gboolean must_free_borders; ActionType action_type; gboolean is_user_action; @@ -330,7 +331,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); } @@ -351,9 +352,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; |