public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: Intel: avs: Fix memory leak in avs_register_i2s_test_boards()
@ 2026-04-07  8:54 Cezary Rojewski
  2026-04-07  8:54 ` [PATCH 2/2] ASoC: Intel: avs: Fix type warning in avs_probe_compr_set_params() Cezary Rojewski
  2026-04-07 12:00 ` (subset) [PATCH 1/2] ASoC: Intel: avs: Fix memory leak in avs_register_i2s_test_boards() Mark Brown
  0 siblings, 2 replies; 6+ messages in thread
From: Cezary Rojewski @ 2026-04-07  8:54 UTC (permalink / raw)
  To: broonie; +Cc: tiwai, perex, amade, linux-sound, Cezary Rojewski

Caller is responsible for freeing array allocated with
parse_int_array().

Found out by Coverity.

Fixes: 7d859189de13 ("ASoC: Intel: avs: Allow to specify custom configurations with i2s_test")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/board_selection.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c
index 8a46285181fa..dd0e7cd5a7dd 100644
--- a/sound/soc/intel/avs/board_selection.c
+++ b/sound/soc/intel/avs/board_selection.c
@@ -520,7 +520,8 @@ static int avs_register_i2s_test_boards(struct avs_dev *adev)
 	if (num_elems > max_ssps) {
 		dev_err(adev->dev, "board supports only %d SSP, %d specified\n",
 			max_ssps, num_elems);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto exit;
 	}
 
 	for (ssp_port = 0; ssp_port < num_elems; ssp_port++) {
@@ -528,11 +529,13 @@ static int avs_register_i2s_test_boards(struct avs_dev *adev)
 		for_each_set_bit(tdm_slot, &tdm_slots, 16) {
 			ret = avs_register_i2s_test_board(adev, ssp_port, tdm_slot);
 			if (ret)
-				return ret;
+				goto exit;
 		}
 	}
 
-	return 0;
+exit:
+	kfree(array);
+	return ret;
 }
 
 static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach *mach)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-07 16:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07  8:54 [PATCH 1/2] ASoC: Intel: avs: Fix memory leak in avs_register_i2s_test_boards() Cezary Rojewski
2026-04-07  8:54 ` [PATCH 2/2] ASoC: Intel: avs: Fix type warning in avs_probe_compr_set_params() Cezary Rojewski
2026-04-07 11:28   ` Mark Brown
2026-04-07 13:16     ` Cezary Rojewski
2026-04-07 14:36       ` Mark Brown
2026-04-07 12:00 ` (subset) [PATCH 1/2] ASoC: Intel: avs: Fix memory leak in avs_register_i2s_test_boards() Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox