From f60fef6f0fb7f0bedd24ceb1d7cf55967d30aac6 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Tue, 12 Mar 2019 10:18:17 -0400 Subject: [PATCH] efl_ui_widget_common: Fix potential resource leak Coverity reports that we potentially leak the storage of 'tree_iterator' here because we allocate the space for it, but potentially juse return due to use of ELM_WIDGET_DATA_GET_OR_RETURN. To fix this, just move the allocation to after the above macro is called. Fixes Coverity CID1399088 @fix Reviewed-by: Stefan Schmidt Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8314 --- src/lib/elementary/efl_ui_widget_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_widget_common.c b/src/lib/elementary/efl_ui_widget_common.c index 519efe21bf..c83fd07c92 100644 --- a/src/lib/elementary/efl_ui_widget_common.c +++ b/src/lib/elementary/efl_ui_widget_common.c @@ -139,8 +139,8 @@ _only_widget(const void *container EINA_UNUSED, void *data, void *fdata EINA_UNU EAPI Eina_Iterator* efl_ui_widget_tree_widget_iterator(Efl_Ui_Widget *obj) { - Eina_Iterator *tree_iterator = efl_ui_widget_tree_iterator(obj); ELM_WIDGET_DATA_GET_OR_RETURN(obj, pd, NULL); + Eina_Iterator *tree_iterator = efl_ui_widget_tree_iterator(obj); return eina_iterator_filter_new(tree_iterator, _only_widget, NULL, NULL); }