summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnish Kumar <kanish@codeaurora.org>2014-08-08 13:29:35 -0700
committerAnish Kumar <kanish@codeaurora.org>2014-10-13 14:56:29 -0700
commit3cde892280b89cd2a1fd1784c33fa9254da41ab9 (patch)
treed74649f1e8aed0cd934336b6e9d178555f7fabc7
parent1b390418e89f0ed95176cdb80c1538d66438294f (diff)
downloadandroid_hardware_qcom_audio-3cde892280b89cd2a1fd1784c33fa9254da41ab9.tar.gz
android_hardware_qcom_audio-3cde892280b89cd2a1fd1784c33fa9254da41ab9.tar.bz2
android_hardware_qcom_audio-3cde892280b89cd2a1fd1784c33fa9254da41ab9.zip
hal: check the pointer before dereference
thermal_client_unregister_callback pointer should be checked for NULL before it is dereferenced. Change-Id: I3b3a46c93c445a723a7db8a64c727c08f6ca5caf
-rw-r--r--hal/audio_extn/spkr_protection.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index b6bb2c97..e6d4d9ae 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -746,7 +746,8 @@ void audio_extn_spkr_prot_init(void *adev)
(const pthread_attr_t *) NULL, spkr_calibration_thread, &handle);
} else {
ALOGE("%s: thermal_client_request failed", __func__);
- if (handle.thermal_client_handle)
+ if (handle.thermal_client_handle &&
+ handle.thermal_client_unregister_callback)
handle.thermal_client_unregister_callback(handle.thermal_client_handle);
if (handle.thermal_handle)
dlclose(handle.thermal_handle);