From ed4aaf4eae31c5169050dac7056d63ec70707585 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Fri, 27 Jun 2014 16:33:39 +0100 Subject: [PATCH 1/2] dbus-monitor: do not leak file descriptors from fd-passing https://bugs.freedesktop.org/show_bug.cgi?id=80603 --- tools/dbus-print-message.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/dbus-print-message.c b/tools/dbus-print-message.c index e0dd2da..320abd6 100644 --- a/tools/dbus-print-message.c +++ b/tools/dbus-print-message.c @@ -352,6 +352,13 @@ print_iter (DBusMessageIter *iter, dbus_bool_t literal, int depth) int fd; dbus_message_iter_get_basic (iter, &fd); printf ("unix fd %d\n", fd); + + /* dbus_message_iter_get_basic() duplicated the fd, we need to + * close it after use. The original fd will be closed when the + * DBusMessage is released. + */ + close (fd); + break; } -- 1.8.5.3