[PATCH][weston 2/3] ivi-layout-transition: Fix potential leak of memory pointed to by transition

Lucas Tanure tanure at linux.com
Wed Sep 23 06:33:22 PDT 2015


Check if transition is not null and if layout_transition_register was ok
before return, if not, free transition

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

diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c
index 716dd70..507de6d 100644
--- a/ivi-shell/ivi-layout-transition.c
+++ b/ivi-shell/ivi-layout-transition.c
@@ -746,9 +746,10 @@ ivi_layout_transition_move_layer(struct ivi_layout_layer *layer,
 		NULL, NULL,
 		duration);
 
-	layout_transition_register(transition);
+	if(transition && layout_transition_register(transition))
+		return;
 
-	return;
+	free(transition);
 }
 
 void
-- 
2.5.3



More information about the wayland-devel mailing list