diff --git a/hal/acdb.c b/hal/acdb.c index 4b1ef31d..52842280 100644 --- a/hal/acdb.c +++ b/hal/acdb.c @@ -5,7 +5,7 @@ * Copyright (C) 2013 The Android Open Source Project * * Changes from Qualcomm Innovation Center are provided under the following license: - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause-Clear * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -248,14 +248,14 @@ cleanup: free(key_info); } + if (my_data->acdb_init_data.snd_card_name) + free(my_data->acdb_init_data.snd_card_name); + if (result < 0) { if (snd_card_name) free((void *)snd_card_name); - if (my_data->acdb_init_data.snd_card_name) - free(my_data->acdb_init_data.snd_card_name); - if (my_data) platform_info_deinit(); } diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c index c7f57263..31bf94ca 100644 --- a/hal/audio_extn/spkr_protection.c +++ b/hal/audio_extn/spkr_protection.c @@ -30,7 +30,7 @@ /* * Changes from Qualcomm Innovation Center are provided under the following license: * -* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted (subject to the limitations in the @@ -1370,8 +1370,8 @@ static void* spkr_calibration_thread() } thermal_fd = open(wsa_path, O_RDONLY); if (thermal_fd > 0) { - if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) { - buf[ret-1] = '\0'; + if ((ret = read(thermal_fd, buf, sizeof(buf)-1)) >= 0) { + buf[ret] = '\0'; t0_spk_1 = atoi(buf); } else @@ -1406,8 +1406,8 @@ static void* spkr_calibration_thread() } thermal_fd = open(wsa_path, O_RDONLY); if (thermal_fd > 0) { - if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) { - buf[ret-1] = '\0'; + if ((ret = read(thermal_fd, buf, sizeof(buf)-1)) >= 0) { + buf[ret] = '\0'; t0_spk_2 = atoi(buf); } else diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 8442a6bd..8e376d29 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -35,7 +35,7 @@ * limitations under the License. * * Changes from Qualcomm Innovation Center are provided under the following license: - * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. * SPDX-License-Identifier: BSD-3-Clause-Clear * */ @@ -10811,8 +10811,13 @@ int adev_create_audio_patch(struct audio_hw_device *dev, s_info = hashmapGet(adev->io_streams_map, (void *) (intptr_t) io_handle); if (s_info == NULL) { ALOGE("%s: Failed to obtain stream info", __func__); - if (new_patch) + if (new_patch) { + + if(p_info->patch) + free(p_info->patch); + free(p_info); + } pthread_mutex_unlock(&adev->lock); ret = -EINVAL; goto done; @@ -10833,8 +10838,13 @@ int adev_create_audio_patch(struct audio_hw_device *dev, if (ret < 0) { pthread_mutex_lock(&adev->lock); s_info->patch_handle = AUDIO_PATCH_HANDLE_NONE; - if (new_patch) + if (new_patch) { + + if(p_info->patch) + free(p_info->patch); + free(p_info); + } pthread_mutex_unlock(&adev->lock); ALOGE("%s: Stream routing failed for io_handle %d", __func__, io_handle); goto done;