Fix file descriptor leak in _dbus_command_for_pid
authorSviatoslav Chagaev <sviatoslav.chagaev@gmail.com>
Tue, 10 Sep 2013 15:23:53 +0000 (18:23 +0300)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 13 Sep 2013 11:25:37 +0000 (12:25 +0100)
Fix a file descriptor not being closed when an error codepath is taken.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69182
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
[more specific commit message -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
dbus/dbus-sysdeps-util-unix.c

index 6cff3fe20de4443d2c110e98e0875e82104516cb..bbc3f3481df039da0f666f17e0090519d9a4517a 100644 (file)
@@ -1144,6 +1144,7 @@ _dbus_command_for_pid (unsigned long  pid,
                       "Failed to read from \"%s\": %s",
                       _dbus_string_get_const_data (&path),
                       _dbus_strerror (errno));      
+      _dbus_close (fd, NULL);
       goto fail;
     }