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/msm8916/platform.c b/hal/msm8916/platform.c
index d05c5ed..82fafc7 100755
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -5113,7 +5113,8 @@
platform->spkr_ch_map->num_ch = num_ch;
for (i = 0; i < num_ch; i++) {
opts = strtok_r(NULL, ", ", &test_r);
- platform->spkr_ch_map->chmap[i] = strtoul(opts, NULL, 16);
+ if (opts != NULL)
+ platform->spkr_ch_map->chmap[i] = strtoul(opts, NULL, 16);
}
}
str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP);