[gtk+] wayland: Ensure we close the fd on all error paths in data_source.send



commit fb266a8876fbba4a983ddb9f6d11295c1e27ef7d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 24 21:55:12 2015 +0200

    wayland: Ensure we close the fd on all error paths in data_source.send
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751414

 gdk/wayland/gdkselection-wayland.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index c5d0089..ac5d38e 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -643,7 +643,10 @@ data_source_send (void                  *data,
            G_STRFUNC, source, mime_type, fd);
 
   if (!mime_type)
-    return;
+    {
+      close (fd);
+      return;
+    }
 
   context = gdk_wayland_drag_context_lookup_by_data_source (source);
 
@@ -652,7 +655,10 @@ data_source_send (void                  *data,
   else if (source == wayland_selection->clipboard_source)
     window = wayland_selection->clipboard_owner;
   else
-    return;
+    {
+      close (fd);
+      return;
+    }
 
   if (!gdk_wayland_selection_request_target (wayland_selection, window,
                                              gdk_atom_intern (mime_type, FALSE),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]