From a62e0e0e02b83d10a2ba1f005ee5bac938f3ea03 Mon Sep 17 00:00:00 2001 From: "U. Artie Eoff" Date: Fri, 17 Jan 2014 15:08:51 -0800 Subject: [PATCH] animation: don't NULL deref if _run() returns NULL Signed-off-by: U. Artie Eoff --- src/animation.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/animation.c b/src/animation.c index ee120367..33875d99 100644 --- a/src/animation.c +++ b/src/animation.c @@ -262,6 +262,9 @@ weston_zoom_run(struct weston_view *view, float start, float stop, zoom_frame, reset_alpha, done, data, NULL); + if (zoom == NULL) + return NULL; + weston_spring_init(&zoom->spring, 300.0, start, stop); zoom->spring.friction = 1400; zoom->spring.previous = start - (stop - start) * 0.03; @@ -291,6 +294,9 @@ weston_fade_run(struct weston_view *view, fade_frame, reset_alpha, done, data, NULL); + if (fade == NULL) + return NULL; + weston_spring_init(&fade->spring, k, start, end); fade->spring.friction = 1400; @@ -337,6 +343,8 @@ weston_stable_fade_run(struct weston_view *front_view, float start, stable_fade_frame, NULL, done, data, back_view); + if (fade == NULL) + return NULL; weston_spring_init(&fade->spring, 400, start, end); fade->spring.friction = 1150; @@ -434,6 +442,10 @@ weston_move_scale_run(struct weston_view *view, int dx, int dy, animation = weston_view_animation_run(view, start, end, move_frame, NULL, move_done, data, move); + + if (animation == NULL) + return NULL; + animation->spring.k = 400; animation->spring.friction = 1150;