diff options
| author | Takashi Iwai <tiwai@suse.de> | 2026-10-07 19:25:20 +0200 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-10-08 08:47:47 +0200 |
| commit | d0f2ca62e89f3c666d0ec203eaa23b8d965e5443 (patch) | |
| tree | 3db5281ec283f6f6e858e543606358741f441106 /tools/lib/python/kdoc/python_version.py | |
| parent | 9d3e19c192b97b4c4c0abcafdbf1edb1e56cee88 (diff) | |
ALSA: pcmtest: Fix leak at probe error
When an error happens at probe of pcmtest driver before
snd_card_register() succeeds, we have to release the card explicitly,
but it's not done, leading to a potential memory leak.
Also, pcmtest driver manages struct pcmtst object unnecessarily
complicatedly by a dynamic allocation and release.
This patch fixes and cleans up the resource management:
- Use card's private_data allocation for struct sndpcmtst at the card
creation, which is released automatically together with the card
- Since the allocation of pcmtest is gone, snd_pcmtst_create() is
rather pointless, so just directly calling snd_pcmtst_new_pcm()
- Use the new auto-clean mechanism to handle the error case at probe.
- Many release handlers became superfluous and dropped
In the end we got a good amount of code reduction.
Fixes: 315a3d57c64c ("ALSA: Implement the new Virtual PCM Test Driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20261007172533.14667-3-tiwai@suse.de
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
