wayland: Ensure we close the fd on all error paths in data_source.send
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 24 Jun 2015 19:55:12 +0000 (21:55 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 24 Jun 2015 21:52:50 +0000 (23:52 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=751414

gdk/wayland/gdkselection-wayland.c

index c5d0089579d0e75dc0af2374e66fb96e5570888a..ac5d38e22d6e12a8a9196ef52681f8850d09df70 100644 (file)
@@ -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),