From 8be14b2e6e65c61ab67cb02441703d66640d1581 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Fri, 6 Mar 2020 16:12:15 -0500 Subject: efl_ui_win: Fix dereference before NULL check This patch fixes an issue detected by Coverity in that 'sdp' is already being dereferenced before we check it. ELM_WIN_DATA_GET can return NULL, so we should check it's return Before trying to use the variable. Fixes CID1419871 --- src/lib/elementary/efl_ui_win.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index d7a6439ddb..c0450eea9c 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -59,7 +59,7 @@ static int _paused_windows = 0; while (0) #define ELM_WIN_DATA_GET(o, sd) \ - Efl_Ui_Win_Data * sd = efl_data_scope_get(o, MY_CLASS) + Efl_Ui_Win_Data *sd = efl_data_scope_get(o, MY_CLASS) #define ELM_WIN_DATA_GET_OR_RETURN(o, ptr, ...) \ ELM_WIN_DATA_GET(o, ptr); \ @@ -3517,8 +3517,11 @@ _elm_win_xwin_update(Efl_Ui_Win_Data *sd) if (sd->parent) { ELM_WIN_DATA_GET(sd->parent, sdp); - _internal_elm_win_xwindow_get(sdp); - if (sdp) ecore_x_icccm_transient_for_set(sd->x.xwin, sdp->x.xwin); + if (sdp) + { + _internal_elm_win_xwindow_get(sdp); + ecore_x_icccm_transient_for_set(sd->x.xwin, sdp->x.xwin); + } } } -- cgit v1.2.1