mirror of https://github.com/encounter/SDL.git
Wayland: Fixed not freeing memory if initialization failed.
This commit is contained in:
parent
dc33fb942d
commit
f87963488b
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue