efl_ui_win: Fix dereference null return
authorChristopher Michael <cp.michael@samsung.com>
Fri, 15 Mar 2019 12:57:54 +0000 (08:57 -0400)
committerYeongjong Lee <yj34.lee@samsung.com>
Tue, 2 Apr 2019 03:45:17 +0000 (12:45 +0900)
Summary:
Coverity reports that efl_data_scope_safe_get returns NULL here
(checked 273 out of 285 times). Add an EINA_SAFETY check before trying
to use 'sd'.

Fixes Coverity CID1399426

@fix

Depends on D8347

Reviewers: raster, cedric, zmike, bu5hm4n, stefan_schmidt

Reviewed By: cedric

Subscribers: #reviewers, #committers

Tags: #efl

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

src/lib/elementary/efl_ui_win.c

index 1b1b7dc..f7b1f7d 100644 (file)
@@ -10235,6 +10235,7 @@ elm_win_keygrab_unset(Elm_Win *obj, const char *key,
    Eina_Bool ret = EINA_FALSE;
 #ifdef HAVE_ELEMENTARY_X
    Efl_Ui_Win_Data *sd = efl_data_scope_safe_get(obj, MY_CLASS);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
    _internal_elm_win_xwindow_get(sd);
    if (sd->x.xwin)
      ret = ecore_x_window_keygrab_unset(sd->x.xwin, key, 0, 0);