diff options
author | orion <orion@FreeBSD.org> | 2002-07-22 02:38:20 +0000 |
---|---|---|
committer | orion <orion@FreeBSD.org> | 2002-07-22 02:38:20 +0000 |
commit | 416c630144514a552e79a1de94a944944f863d37 (patch) | |
tree | 56d0adf1bc43efd06afe2e7eb917ad8a708a6503 | |
parent | c54722752c72c5ac5e8da2c6cfe0b80588d10ae2 (diff) | |
download | FreeBSD-src-416c630144514a552e79a1de94a944944f863d37.zip FreeBSD-src-416c630144514a552e79a1de94a944944f863d37.tar.gz |
Move lock in pcm_chn_add() to after malloc.
PR: kern/40157
Submitted by: Dan Lukes <dan@obluda.cz>
-rw-r--r-- | sys/dev/sound/pcm/sound.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 85efa26..ddf466b 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -428,14 +428,13 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev) struct snddev_channel *sce, *tmp, *after; int unit = device_get_unit(d->dev); - snd_mtxlock(d->lock); - sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO); if (!sce) { - snd_mtxunlock(d->lock); return ENOMEM; } + snd_mtxlock(d->lock); + sce->channel = ch; if (SLIST_EMPTY(&d->channels)) { SLIST_INSERT_HEAD(&d->channels, sce, link); |