From d00d7d5c39df46759346c0cf3ed0562b2a23f1b3 Mon Sep 17 00:00:00 2001 From: Brian Feldman Date: Tue, 11 Feb 2003 16:58:54 +0000 Subject: [PATCH] Sound devices were being leaked by dsp_open() not actually releasing the channels it allocates if chn_reset() on them resulted in failure. ARROW'D! --- sys/dev/sound/pcm/dsp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index dd69dcfc11e4..f2d463c53e2f 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -274,8 +274,11 @@ dsp_open(dev_t i_dev, int flags, int mode, struct thread *td) if (chn_reset(rdch, fmt)) { pcm_lock(d); pcm_chnrelease(rdch); - if (wrch && (flags & FWRITE)) + i_dev->si_drv1 = NULL; + if (wrch && (flags & FWRITE)) { pcm_chnrelease(wrch); + i_dev->si_drv2 = NULL; + } pcm_unlock(d); splx(s); return ENODEV; @@ -289,10 +292,12 @@ dsp_open(dev_t i_dev, int flags, int mode, struct thread *td) if (chn_reset(wrch, fmt)) { pcm_lock(d); pcm_chnrelease(wrch); + i_dev->si_drv2 = NULL; if (flags & FREAD) { CHN_LOCK(rdch); pcm_chnref(rdch, -1); pcm_chnrelease(rdch); + i_dev->si_drv1 = NULL; } pcm_unlock(d); splx(s);