Sheetal f2c7bd17be ASoC: tegra: Fix memory leak in OOT machine driver
Fix a memory leak in the NVIDIA Tegra ASoC machine driver where
allocated DAPM widget lists were never freed. The function
dpcm_runtime_set_dai_fmt() calls snd_soc_dapm_dai_get_connected_widgets()
which allocates memory for a widget list, but was returning without
calling snd_soc_dapm_dai_free_widgets() to free this memory.

The leak was detected by kmemleak:
  unreferenced object 0xffff00008fc7e300 (size 192):
    comm "alsactl", pid 812, jiffies 4294900395
    backtrace:
      kmemleak_alloc+0xc0/0xe8
      __kmalloc+0x2e0/0x4c8
      snd_soc_dapm_dai_get_connected_widgets+0x108/0x2a0

Fix this by using snd_soc_dapm_dai_free_widgets() on
success or failure to ensure the widget list is always freed
before returning.

Bug 5667057
Change-Id: Ied69968884fc0646a3041e54427736ff1fc232ac
Signed-off-by: Sheetal <sheetal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3500426
(cherry picked from commit 14b3fc2296967968d5972054bff38cf1bf4b518e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3502770
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Mohan kumar <mkumard@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-12-03 05:57:54 -08:00
2025-07-31 07:43:27 -07:00
2025-10-13 17:57:26 -07:00
2022-12-07 23:57:14 -08:00
2025-07-24 10:19:10 +00:00
2024-02-24 05:24:07 -08:00
2025-07-31 07:43:31 -07:00
Description
No description provided
34 MiB