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
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 9f90d93..7b7e818 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -8741,9 +8741,9 @@
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);