hal: miscellaneous fixes
Fixes for the following issues reported by KW
21725, 21726, 21727, 21737, 21738, 21739, 21740, 21750,
21751, 21752, 25317, 30602, 32620, 36778, 41817, 41819,
50942, 54468, 54470, 54479, 55569, 54481, 55570, 55571,
58485, 85112, 85122, 85123
Change-Id: I9abef07db7ccdc19789a201eb268a97e1b360cad
diff --git a/hal/msm8974/hw_info.c b/hal/msm8974/hw_info.c
index 7ac5ce7..f7d19f4 100644
--- a/hal/msm8974/hw_info.c
+++ b/hal/msm8974/hw_info.c
@@ -329,6 +329,11 @@
struct hardware_info *hw_info;
hw_info = malloc(sizeof(struct hardware_info));
+ if (!hw_info) {
+ ALOGE("failed to allocate mem for hardware info");
+ return NULL;
+ }
+
hw_info->snd_devices = NULL;
hw_info->num_snd_devices = 0;
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index f853506..5ba3372 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -477,6 +477,11 @@
{
struct csd_data *csd = calloc(1, sizeof(struct csd_data));
+ if (!csd) {
+ ALOGE("failed to allocate csd_data mem");
+ return NULL;
+ }
+
csd->csd_client = dlopen(LIB_CSD_CLIENT, RTLD_NOW);
if (csd->csd_client == NULL) {
ALOGE("%s: DLOPEN failed for %s", __func__, LIB_CSD_CLIENT);
@@ -658,6 +663,11 @@
my_data = calloc(1, sizeof(struct platform_data));
+ if (!my_data) {
+ ALOGE("failed to allocate platform data");
+ return NULL;
+ }
+
while (snd_card_num < MAX_SND_CARD) {
adev->mixer = mixer_open(snd_card_num);