summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-05-13 09:01:20 +0000
committerngie <ngie@FreeBSD.org>2016-05-13 09:01:20 +0000
commit98e5307b424d86f0e874f73834d19a75f3ef0ad8 (patch)
tree439827d5bb31d8876cd7f7f2e38e16ff1d2498ad /sys
parent747508b629539c8c76579e129969af89cc1cb292 (diff)
downloadFreeBSD-src-98e5307b424d86f0e874f73834d19a75f3ef0ad8.zip
FreeBSD-src-98e5307b424d86f0e874f73834d19a75f3ef0ad8.tar.gz
MFC r298339:
r298339 (by cem): sound(4): Don't use-after-free in midi module unload Also, use ANSI function parameter definitions (void) while here. CID: 1006107
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sound/midi/midi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index e741dd0d..3dea05d 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -1401,7 +1401,7 @@ midi_destroy(struct snd_midi *m, int midiuninit)
*/
static int
-midi_load()
+midi_load(void)
{
mtx_init(&midistat_lock, "midistat lock", NULL, 0);
TAILQ_INIT(&midi_devs); /* Initialize the queue. */
@@ -1414,9 +1414,9 @@ midi_load()
}
static int
-midi_unload()
+midi_unload(void)
{
- struct snd_midi *m;
+ struct snd_midi *m, *tmp;
int retval;
MIDI_DEBUG(1, printf("midi_unload()\n"));
@@ -1425,7 +1425,7 @@ midi_unload()
if (midistat_isopen)
goto exit0;
- TAILQ_FOREACH(m, &midi_devs, link) {
+ TAILQ_FOREACH_SAFE(m, &midi_devs, link, tmp) {
mtx_lock(&m->lock);
if (m->busy)
retval = EBUSY;
OpenPOWER on IntegriCloud