From 06d8aa7ef75e035a36697a53f1a65e79cb072515 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Fri, 6 Mar 2020 16:12:15 -0500 Subject: [PATCH] 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 c0e9a9f..cd84eb7 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -61,7 +61,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); \ @@ -4186,8 +4186,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); + } } } -- 2.7.4