Commit f87963488b6f18516d8d8ff6fe3a291ed5e68e4a

Philipp Wiesemann 2015-04-09T21:13:41

Wayland: Fixed not freeing memory if initialization failed.

diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 2e74a08..fd92026 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");
     }