elm_focus_legacy: Fix resource leaks

Summary:
Coverity reports 2 resource leaks here because old_chain & new_chain
are never freed if we fail to return widget data. Use just
ELM_WIDGET_DATA_GET, manually check for valid 'ppd' and if false we
can just break out of the for loop here.

Fixes Coverity CID1399096, CID1399095

@fix

Depends on D8352

Reviewers: raster, cedric, zmike, bu5hm4n, stefan_schmidt

Reviewed By: cedric, bu5hm4n

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8353
This commit is contained in:
Christopher Michael 2019-03-18 14:47:58 -04:00
parent cced5487c8
commit 2abe5ad9bc
1 changed files with 6 additions and 1 deletions

View File

@ -245,7 +245,12 @@ elm_object_focus_next(Evas_Object *obj,
{
Evas_Object *parent = eina_array_data_get(old_chain, i);
if (!elm_widget_is(parent)) continue;
ELM_WIDGET_DATA_GET_OR_RETURN(parent, ppd);
ELM_WIDGET_DATA_GET(parent, ppd);
if (!ppd)
{
ERR("Failed to get Elm widget data for parent");
break;
}
legacy_target = _get_legacy_target(parent, ppd, dir);
if (legacy_target) break;
}