From 5c6da2669cea95d775b4a1ab0ddcdad4cac82671 Mon Sep 17 00:00:00 2001 From: Peng Qi Date: Tue, 22 Aug 2017 17:38:34 +0800 Subject: [PATCH] Bluetooth: AsyncFdWatcher: Fix FD leak AsyncFdWatcher thread notification pipe fds without close which causes FD leak under Bluetooth on/off stress test. Close the notification pipe fds when shut down Bluetooth. Test: Bluetooth on/off stress test Change-Id: I7575adec49161f9764f0e070ef3c1043b8295a97 --- bluetooth/1.0/default/async_fd_watcher.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bluetooth/1.0/default/async_fd_watcher.cc b/bluetooth/1.0/default/async_fd_watcher.cc index bc0bc928d2..d8714f5b5b 100644 --- a/bluetooth/1.0/default/async_fd_watcher.cc +++ b/bluetooth/1.0/default/async_fd_watcher.cc @@ -105,6 +105,9 @@ int AsyncFdWatcher::stopThread() { timeout_cb_ = nullptr; } + close(notification_listen_fd_); + close(notification_write_fd_); + return 0; }