git: 16329b7b3276 - main - sound: Fix memory leak in chn_init()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 27 Jul 2024 11:56:24 UTC
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=16329b7b3276f09dc70bdd1ca8bc605546fe71e0 commit 16329b7b3276f09dc70bdd1ca8bc605546fe71e0 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2024-07-27 11:55:19 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2024-07-27 11:55:19 +0000 sound: Fix memory leak in chn_init() In case chn_init() fails, we are leaking memory by not freeing the feeder. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D45979 --- sys/dev/sound/pcm/channel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index a18ef1cf4234..19808a43631a 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1365,6 +1365,8 @@ out2: if (CHN_LOCKOWNED(c)) CHN_UNLOCK(c); if (ret) { + while (chn_removefeeder(c) == 0) + ; if (c->devinfo) { if (CHANNEL_FREE(c->methods, c->devinfo)) sndbuf_free(b);