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

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


Destroy transition if layout_transition_register was not ok, we can't
just free transition, we need to call layout_transition_destroy in order
to free private_data from transition

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

diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c
index 507de6d..7b17544 100644
--- a/ivi-shell/ivi-layout-transition.c
+++ b/ivi-shell/ivi-layout-transition.c
@@ -873,7 +873,8 @@ ivi_layout_transition_fade_layer(
 	data->end_alpha = end_alpha;
 	data->destroy_func = destroy_func;
 
-	layout_transition_register(transition);
+	if(!layout_transition_register(transition))
+		layout_transition_destroy(transition)
 
 	return;
 }
-- 
2.5.3



More information about the wayland-devel mailing list