[PATCH][weston] ivi-layout-transition: Standardize the check for layout_transition_register

Lucas Tanure tanure at linux.com
Wed Sep 30 05:38:37 PDT 2015


Check the return from layout_transition_register in order to fix
potential leak of memory pointed to by transition. And don't register a
null transition.

Signed-off-by: Lucas Tanure <tanure at linux.com>
---
 ivi-shell/ivi-layout-transition.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c
index adaa543..483437d 100644
--- a/ivi-shell/ivi-layout-transition.c
+++ b/ivi-shell/ivi-layout-transition.c
@@ -418,7 +418,9 @@ ivi_layout_transition_move_resize_view(struct ivi_layout_surface *surface,
 		transition_move_resize_view_destroy,
 		duration);
 
-	layout_transition_register(transition);
+	if(transition && layout_transition_register(transition))
+		return;
+	layout_transition_destroy(transition);
 }
 
 /* fade transition */
@@ -512,8 +514,9 @@ create_visibility_transition(struct ivi_layout_surface *surface,
 		destroy_func,
 		duration);
 
-	if (!layout_transition_register(transition))
-		layout_transition_destroy(transition);
+	if (transition && layout_transition_register(transition))
+		return;
+	layout_transition_destroy(transition);
 }
 
 static void
-- 
2.6.0



More information about the wayland-devel mailing list