dbus-monitor: do not leak file descriptors from fd-passing

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80603
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
Alban Crequy 2014-06-27 16:33:39 +01:00 committed by Simon McVittie
parent 6864780bd6
commit eb4584d5c5

View file

@ -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;
}