mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
Move lock in pcm_chn_add() to after malloc.
PR: kern/40157 Submitted by: Dan Lukes <dan@obluda.cz>
This commit is contained in:
parent
0cd59a38ce
commit
7cf0e77a00
1 changed files with 2 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue