[PATCH][weston] animation: Fix potential leak of memory pointed to by move

Bryce Harrington bryce at osg.samsung.com
Mon Oct 5 18:55:08 PDT 2015


On Sun, Oct 04, 2015 at 06:43:48PM +0300, Giulio Camuffo wrote:
> 2015-10-03 17:18 GMT+03:00 Lucas Tanure <tanure at linux.com>:
> > Free move before return if animation is null.
> >
> > Signed-off-by: Lucas Tanure <tanure at linux.com>
> 
> Reviewed-by: Giulio Camuffo <giuliocamuffo at gmail.com>
> 
> > ---
> >  src/animation.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/animation.c b/src/animation.c
> > index cc7482d..2c7943f 100644
> > --- a/src/animation.c
> > +++ b/src/animation.c
> > @@ -471,8 +471,10 @@ weston_move_scale_run(struct weston_view *view, int dx, int dy,
> >         animation = weston_view_animation_create(view, start, end, move_frame,
> >                                                  NULL, move_done, data, move);
> >
> > -       if (animation == NULL)
> > +       if (animation == NULL){
> > +               free(move);
> >                 return NULL;
> > +       }
> >
> >         weston_spring_init(&animation->spring, 400.0, 0.0, 1.0);
> >         animation->spring.friction = 1150;

weston_view_animation_create() creates an animation structure and stores
move in its animation->private member.  I see that move_done() will free
this data, but I wonder if weston_view_animation_destroy() also needs to
do this, for cleanup?

In any case, that can be handled as followup.  This patch looks good to
me, so:

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

remote: I: patch #60977 updated using rev ed8dd4ef6a9bf253e3638678273f6785db1a24b6
remote: I: 1 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/wayland/weston
   3c241b1..ed8dd4e  master -> master


Bryce

> > --
> > Pushed.6.0
> >
> > _______________________________________________
> > wayland-devel mailing list
> > wayland-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list