From 998e4cfbfb6912a4e7d9bd562a02a45e41798cf3 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Tue, 17 Mar 2020 19:27:13 -0700 Subject: [PATCH] thermal: Fix bugprone-use-after-move. fd was moved out of, so we were adding -1 to the looper. Bug: http://b/150783499 Test: treehugger (cherry picked from commit 56ed76601d2fa5f1a1e6f7f24d79975a69f43a39) Change-Id: Ib571f32078fd9adb91a1e619110330583b75482b --- hidl/thermal/utils/thermal_watcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hidl/thermal/utils/thermal_watcher.cpp b/hidl/thermal/utils/thermal_watcher.cpp index 02982160..08a7e390 100644 --- a/hidl/thermal/utils/thermal_watcher.cpp +++ b/hidl/thermal/utils/thermal_watcher.cpp @@ -47,8 +47,8 @@ void ThermalWatcher::registerFilesToWatch(const std::set &sensors_t continue; } watch_to_file_path_map_.emplace(fd.get(), path); - fds_.emplace_back(std::move(fd)); looper_->addFd(fd.get(), 0, Looper::EVENT_INPUT, nullptr, nullptr); + fds_.emplace_back(std::move(fd)); } monitored_sensors_.insert(sensors_to_watch.begin(), sensors_to_watch.end()); if (!uevent_monitor) {