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 free after use issue.
Change-Id: Idfdef719320efcd792c7d2ebd7ec2dfe5d3fbfbd
(cherry picked from commit 6a98bd5eae995d3ffc56b41f20fe7ac03f5ddb5b)
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index b255d3e..30a7748 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -7722,9 +7722,9 @@
static int adev_close(hw_device_t *device)
{
- 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);