diff options
author | Carter Hsu <carterhsu@google.com> | 2019-10-21 09:58:17 +0800 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-11-15 21:43:33 +0000 |
commit | bdcd0cec60e1d56da76816d5b8717d8b68fdaf2e (patch) | |
tree | 56cb73a9204bdf3bd3019b7d5d0eb43ea89f6ce6 | |
parent | 2ea16ffc94dde200c2ab84c83210b82b1a953860 (diff) | |
download | android_hardware_qcom_audio-bdcd0cec60e1d56da76816d5b8717d8b68fdaf2e.tar.gz android_hardware_qcom_audio-bdcd0cec60e1d56da76816d5b8717d8b68fdaf2e.tar.bz2 android_hardware_qcom_audio-bdcd0cec60e1d56da76816d5b8717d8b68fdaf2e.zip |
audio: free and assign NULL to global static device pointer
From: Preetam Singh Ranawat <apranawat@codeaurora.org>
Date: Mon, 24 Jun 2019 15:11:28 +0530
Subject: audio: free and assign NULL to global static device pointer
-free and assign NULL to global static device pointer instead of local
pointer to avoid use after free issue.
Bug: 142267478
Test: manual
Change-Id: I6f64fe0f6034844279c9a481726426dc5b989b41
(cherry picked from commit 73d6b59977595c1d0a222a1656f298e7991e43b9)
-rw-r--r-- | hal/audio_hw.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 58d8f856..1c99066f 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -6282,9 +6282,9 @@ static int adev_verify_devices(struct audio_device *adev) static int adev_close(hw_device_t *device) { size_t i; - struct audio_device *adev = (struct audio_device *)device; + struct audio_device *adev_temp = (struct audio_device *)device; - if (!adev) + if (!adev_temp) return 0; pthread_mutex_lock(&adev_init_lock); |