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
This commit is contained in:
Christos Margiolis 2024-07-27 14:55:19 +03:00
parent 94a86f3f69
commit 16329b7b32

View file

@ -1365,6 +1365,8 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls,
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);