ecore_wl2: Prevent use after free on input deletion
authorDerek Foreman <derekf@osg.samsung.com>
Wed, 4 Jan 2017 17:40:17 +0000 (11:40 -0600)
committerDerek Foreman <derekf@osg.samsung.com>
Thu, 5 Jan 2017 19:40:31 +0000 (13:40 -0600)
Window structs keep inputs around, so we should sweep through them
and NULL out any stale ones on a delete.

src/lib/ecore_wl2/ecore_wl2_input.c

index c2fbe48..3e7fd98 100644 (file)
@@ -1443,6 +1443,7 @@ _ecore_wl2_input_del(Ecore_Wl2_Input *input)
    Ecore_Wl2_Display *display;
    Eina_Inlist *l = NULL;
    Ecore_Wl2_Mouse_Down_Info *info = NULL;
+   Ecore_Wl2_Window *window;
 
    if (!input) return;
 
@@ -1490,6 +1491,9 @@ _ecore_wl2_input_del(Ecore_Wl2_Input *input)
    display->inputs =
      eina_inlist_remove(display->inputs, EINA_INLIST_GET(input));
 
+   EINA_INLIST_FOREACH(display->windows, window)
+     if (window->input == input) window->input = NULL;
+
    free(input);
 }