From d05a39d0a68b573541bb6d43c04fb89ac1a7a61d Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Fri, 18 Nov 2016 00:05:54 +0100 Subject: [PATCH] Wayland: Fixed file descriptor leaks if device was not initialized. --- src/video/wayland/SDL_waylanddatamanager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c index 323eff7b7..d1feb733b 100644 --- a/src/video/wayland/SDL_waylanddatamanager.c +++ b/src/video/wayland/SDL_waylanddatamanager.c @@ -347,10 +347,10 @@ Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, if (offer == NULL) { SDL_SetError("Invalid data offer"); - } else if (pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { - SDL_SetError("Could not read pipe"); } else if ((data_device = offer->data_device) == NULL) { SDL_SetError("Data device not initialized"); + } else if (pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { + SDL_SetError("Could not read pipe"); } else { wl_data_offer_receive(offer->offer, mime_type, pipefd[1]);