Wayland: Fixed not freeing memory if initialization failed.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Thu, 09 Apr 2015 21:13:41 +0200
changeset 948584407b33fe1e
parent 9484 8828b1a0ab67
child 9486 296b5f754af7
Wayland: Fixed not freeing memory if initialization failed.
src/video/wayland/SDL_waylandvideo.c
     1.1 --- a/src/video/wayland/SDL_waylandvideo.c	Thu Apr 09 21:13:20 2015 +0200
     1.2 +++ b/src/video/wayland/SDL_waylandvideo.c	Thu Apr 09 21:13:41 2015 +0200
     1.3 @@ -284,11 +284,13 @@
     1.4  
     1.5      data->display = WAYLAND_wl_display_connect(NULL);
     1.6      if (data->display == NULL) {
     1.7 +        SDL_free(data);
     1.8          return SDL_SetError("Failed to connect to a Wayland display");
     1.9      }
    1.10  
    1.11      data->registry = wl_display_get_registry(data->display);
    1.12      if (data->registry == NULL) {
    1.13 +        SDL_free(data);
    1.14          return SDL_SetError("Failed to get the Wayland registry");
    1.15      }
    1.16  
    1.17 @@ -302,6 +304,7 @@
    1.18  
    1.19      data->xkb_context = WAYLAND_xkb_context_new(0);
    1.20      if (!data->xkb_context) {
    1.21 +        SDL_free(data);
    1.22          return SDL_SetError("Failed to create XKB context");
    1.23      }
    1.24