hal: fix null pointer references and data initialization errors
- add null pointer check and initialize uninitialized variables
CRs-Fixed: 2312146
Change-Id: I5f260b327492e1373ed143dd8dcf243154fd7818
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index f31991a..41f76c6 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2021,10 +2021,10 @@
struct stream_out stream_out;
audio_usecase_t hfp_ucid;
int status = 0;
- audio_devices_t audio_device;
- audio_channel_mask_t channel_mask;
- int sample_rate;
- int acdb_id;
+ audio_devices_t audio_device = AUDIO_DEVICE_NONE;
+ audio_channel_mask_t channel_mask = AUDIO_CHANNEL_NONE;
+ int sample_rate = 0;
+ int acdb_id = 0;
ALOGD("%s for use case (%s)", __func__, use_case_table[uc_id]);