Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Jul 2024 11:56:24 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 16329b7b3276 - main - sound: Fix memory leak in chn_init()
Message-ID:  <202407271156.46RBuOuu039884@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407271156.46RBuOuu039884>