From f87963488b6f18516d8d8ff6fe3a291ed5e68e4a Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Thu, 9 Apr 2015 21:13:41 +0200 Subject: [PATCH] Wayland: Fixed not freeing memory if initialization failed. --- src/video/wayland/SDL_waylandvideo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 2e74a086910a4..fd92026e92e22 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -284,11 +284,13 @@ Wayland_VideoInit(_THIS) data->display = WAYLAND_wl_display_connect(NULL); if (data->display == NULL) { + SDL_free(data); return SDL_SetError("Failed to connect to a Wayland display"); } data->registry = wl_display_get_registry(data->display); if (data->registry == NULL) { + SDL_free(data); return SDL_SetError("Failed to get the Wayland registry"); } @@ -302,6 +304,7 @@ Wayland_VideoInit(_THIS) data->xkb_context = WAYLAND_xkb_context_new(0); if (!data->xkb_context) { + SDL_free(data); return SDL_SetError("Failed to create XKB context"); }