Module Name:    src
Committed By:   nat
Date:           Wed Nov 15 01:49:59 UTC 2017

Modified Files:
        src/sys/dev: audio.c

Log Message:
Plug memory leak as the mixer state does not grow or shrink when audio
mixing is disabled.  This avoids triggering a panic also.


To generate a diff of this commit:
cvs rdiff -u -r1.432 -r1.433 src/sys/dev/audio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.432 src/sys/dev/audio.c:1.433
--- src/sys/dev/audio.c:1.432	Wed Nov 15 01:45:57 2017
+++ src/sys/dev/audio.c	Wed Nov 15 01:49:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.432 2017/11/15 01:45:57 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.433 2017/11/15 01:49:59 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.432 2017/11/15 01:45:57 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.433 2017/11/15 01:49:59 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2310,7 +2310,8 @@ audio_open(dev_t dev, struct audio_softc
 
 	DPRINTF(("audio_open: done sc_mode = 0x%x\n", vc->sc_mode));
 
-	grow_mixer_states(sc, 2);
+	if (sc->sc_usemixer)
+		grow_mixer_states(sc, 2);
 	if (flags & FREAD)
 		sc->sc_recopens++;
 	if (flags & FWRITE)

Reply via email to