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!
This commit is contained in:
Brian Feldman 2003-02-11 16:58:54 +00:00
parent e937a222a6
commit d00d7d5c39
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=110717

View File

@ -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);