Wayland: Fixed file descriptor leaks if device was not initialized.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Fri, 18 Nov 2016 00:05:54 +0100
changeset 10630e84b1dbe4113
parent 10629 813f1b3c63aa
child 10631 29871de88287
Wayland: Fixed file descriptor leaks if device was not initialized.
src/video/wayland/SDL_waylanddatamanager.c
     1.1 --- a/src/video/wayland/SDL_waylanddatamanager.c	Fri Nov 18 00:05:28 2016 +0100
     1.2 +++ b/src/video/wayland/SDL_waylanddatamanager.c	Fri Nov 18 00:05:54 2016 +0100
     1.3 @@ -347,10 +347,10 @@
     1.4  
     1.5      if (offer == NULL) {
     1.6          SDL_SetError("Invalid data offer");
     1.7 +    } else if ((data_device = offer->data_device) == NULL) {
     1.8 +        SDL_SetError("Data device not initialized");
     1.9      } else if (pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) {
    1.10          SDL_SetError("Could not read pipe");
    1.11 -    } else if ((data_device = offer->data_device) == NULL) {
    1.12 -        SDL_SetError("Data device not initialized");
    1.13      } else {
    1.14          wl_data_offer_receive(offer->offer, mime_type, pipefd[1]);
    1.15