Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db6236ab authored by Chaithanya Krishna Bacharaju's avatar Chaithanya Krishna Bacharaju Committed by Gerrit - the friendly Code Review server
Browse files

hal: Fixes for the issues reported by KlocWork

-Fixes for KW issues reported which may cause NULL dereference:
283559, 293531, 293533, 309145

Change-Id: Ic0a1e891ba7a013ed48f1e5c82d4051f8e8b5a9d
parent 1d92da00
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -186,6 +186,9 @@ static void parse_sample_rate_names(char *name, struct streams_output_cfg *so_in
        ALOGV("%s: sample_rate - %d", __func__, sample_rate);
        if (0 != sample_rate) {
            ss_info = (struct stream_sample_rate *)calloc(1, sizeof(struct stream_sample_rate));
            if (ss_info == NULL)
                break; /* return whatever was parsed */

            ss_info->sample_rate = sample_rate;
            list_add_tail(&so_info->sample_rate_list, &ss_info->list);
        }
+4 −0
Original line number Diff line number Diff line
@@ -226,6 +226,10 @@ void *hw_info_init(const char *snd_card_name)
    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;
    }

    if (strstr(snd_card_name, "msm8x16") || strstr(snd_card_name, "msm8939") ||
        strstr(snd_card_name, "msm8909")) {
+8 −0
Original line number Diff line number Diff line
@@ -694,6 +694,10 @@ void platform_set_echo_reference(void *platform, bool enable)
static struct csd_data *open_csd_client()
{
    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) {
@@ -961,6 +965,10 @@ void *platform_init(struct audio_device *adev)
    char *cvd_version = NULL;

    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);