evas_device: Fix dereferencing null pointer
authorChristopher Michael <cp.michael@samsung.com>
Tue, 12 Mar 2019 14:15:00 +0000 (10:15 -0400)
committerYeongjong Lee <yj34.lee@samsung.com>
Tue, 2 Apr 2019 03:45:17 +0000 (12:45 +0900)
Coverity reports that 'pos' could be null here and we are potentially
dereferencing a NULL pointer, so lets add a check for 'pos' here
before trying to use it.

Fixes Coverity CID1399091

@fix

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8313

src/lib/evas/canvas/evas_device.c

index 2e5e141b7639e1d4ebf5702c8993a97018f5d4e0..c07748ea442408974b2a7448d7df1fa14cb0c00d 100644 (file)
@@ -538,7 +538,9 @@ _evas_canvas_efl_canvas_scene_pointer_position_get(const Eo *eo_e, Evas_Public_D
    Eina_Iterator *it;
    Eo *child;
 
-   if (pos) *pos = EINA_POSITION2D(0, 0);
+   if (!pos) return EINA_FALSE;
+
+   *pos = EINA_POSITION2D(0, 0);
    if (!e->default_seat) return EINA_FALSE;
    if (!seat)
      {
@@ -553,6 +555,7 @@ _evas_canvas_efl_canvas_scene_pointer_position_get(const Eo *eo_e, Evas_Public_D
        break;
    if (child)
      *pos = efl_input_pointer_position_get(child);
+
    eina_iterator_free(it);
    return !!child;
 }