Avoid duplicate closing on Tuner instances
set all the successfully closed instance to null
to avoid duplicate closing on the same instance.
Test: make
Bug: 176190508
Change-Id: Ie96a5de3dcc1c40a594b4bb94bf31e546a77eb40
diff --git a/media/jni/tuner/FrontendClient.cpp b/media/jni/tuner/FrontendClient.cpp
index 3a00133..4a72eba 100644
--- a/media/jni/tuner/FrontendClient.cpp
+++ b/media/jni/tuner/FrontendClient.cpp
@@ -311,15 +311,14 @@
Result FrontendClient::close() {
if (mTunerFrontend != NULL) {
Status s = mTunerFrontend->close();
+ mTunerFrontend = NULL;
return ClientHelper::getServiceSpecificErrorCode(s);
}
if (mFrontend != NULL) {
Result result = mFrontend->close();
- if (result == Result::SUCCESS) {
- mFrontend = NULL;
- mFrontend_1_1 = NULL;
- }
+ mFrontend = NULL;
+ mFrontend_1_1 = NULL;
return result;
}