From 5105960d49bfa86efeeea8f87c87aa96b5771c37 Mon Sep 17 00:00:00 2001 From: Aravind Akella Date: Tue, 23 Sep 2014 16:42:49 -0700 Subject: [PATCH] Fix sockfd leakage in SensorService. Remove sockfd from Looper when the connection is removed from mActiveConnections. Bug: 17472228 Change-Id: Iaabe0968bd2104ef961ff5e8659bf91712e2e1db --- services/sensorservice/SensorService.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp index f953a960a..77ada40de 100644 --- a/services/sensorservice/SensorService.cpp +++ b/services/sensorservice/SensorService.cpp @@ -653,6 +653,7 @@ void SensorService::cleanupConnection(SensorEventConnection* c) i++; } } + mLooper->removeFd(c->getSensorChannel()->getSendFd()); mActiveConnections.remove(connection); BatteryService::cleanup(c->getUid()); if (c->needsWakeLock()) { @@ -799,6 +800,7 @@ status_t SensorService::cleanupWithoutDisableLocked( BatteryService::disableSensor(connection->getUid(), handle); } if (connection->hasAnySensor() == false) { + mLooper->removeFd(connection->getSensorChannel()->getSendFd()); mActiveConnections.remove(connection); } // see if this sensor becomes inactive