[mutter/wip/carlosg/pipe-leak] wayland: Close pipe file descriptors after use




commit 421c28773ac38c784062e9cfdacbc6bb9400c11b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue May 18 17:57:56 2021 +0200

    wayland: Close pipe file descriptors after use
    
    Both ends were being leaked here, one directly, other through the
    GIOChannel.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4302
    (just maybe)

 src/wayland/meta-wayland-data-device.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index dd9c162e77..2f3c154a1d 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -425,7 +425,9 @@ meta_wayland_data_source_fake_read (MetaWaylandDataSource *source,
     }
 
   meta_wayland_data_source_send (source, mimetype, p[1]);
+  close (p[1]);
   channel = g_io_channel_unix_new (p[0]);
+  g_io_channel_set_close_on_unref (channel, TRUE);
   g_io_add_watch (channel, G_IO_HUP, on_fake_read_hup, source);
 }
 


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