⬢ DragonFlyBSD Kernel Audit
DF-4096 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/sound/pci/emu10k1.c
+++ b/sys/dev/sound/pci/emu10k1.c
@@ -824,6 +824,10 @@
 	ch->master = emu_valloc(sc);
 	ch->slave = emu_valloc(sc);
 	snd_mtxunlock(sc->lock);
+	if (ch->master == NULL || ch->slave == NULL) {
+		device_printf(sc->dev, "out of emu10k1 voices\n");
+		return NULL;
+	}
 	r = (emu_vinit(sc, ch->master, ch->slave, sc->bufsz, ch->buffer))
 	    ? NULL : ch;