From 88ba6798e9c538337037a778266bea79ab021791 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Wed, 30 Oct 2019 21:12:36 +0100 Subject: [PATCH] Wayland: touch events, use of memory after it is freed --- src/video/wayland/SDL_waylandevents.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 2f842e1948700..013ac660b3775 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -151,10 +151,14 @@ touch_del(SDL_TouchID id, float* x, float* y, struct wl_surface **surface) touch_points.tail = tp->prev; } - SDL_free(tp); + { + struct SDL_WaylandTouchPoint *next = tp->next; + SDL_free(tp); + tp = next; + } + } else { + tp = tp->next; } - - tp = tp->next; } }