efl_ui_focus_manager_calc: Fix resource leaks
authorChristopher Michael <cp.michael@samsung.com>
Fri, 15 Mar 2019 16:57:18 +0000 (12:57 -0400)
committerYeongjong Lee <yj34.lee@samsung.com>
Tue, 2 Apr 2019 03:45:17 +0000 (12:45 +0900)
Summary:
Coverity reports that we leak old_chain & chain variables here if we return.
Add an eina_array_free for both to clean this up.

Fixes Coverity CID1396984,CID1396965

@fix

Depends on D8353

Reviewers: raster, cedric, zmike, bu5hm4n, stefan_schmidt

Reviewed By: cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8355

src/lib/elementary/efl_ui_focus_manager_calc.c

index e64ee99..9dbab17 100644 (file)
@@ -1489,7 +1489,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_manager_focus_set(Eo *obj, Efl_U
      {
         //the correct one is focused
         if (node->redirect_manager == pd->redirect)
-          return;
+          goto end;
      }
 
    //make sure this manager is in the chain of redirects
@@ -1571,6 +1571,7 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_manager_focus_set(Eo *obj, Efl_U
    while (eina_array_count(old_chain) > 1)
      efl_event_callback_call(eina_array_pop(old_chain), EFL_UI_FOCUS_OBJECT_EVENT_CHILD_FOCUS_CHANGED, (void*)EINA_FALSE);
 
+end:
    eina_array_free(old_chain);
    eina_array_free(chain);
 }