svn commit: r282226 - head/sys/dev/kbdmux

Pedro F. Giffuni pfg at FreeBSD.org
Wed Apr 29 15:41:19 UTC 2015


Author: pfg
Date: Wed Apr 29 15:41:19 2015
New Revision: 282226
URL: https://svnweb.freebsd.org/changeset/base/282226

Log:
  Plug memory leaks in kbdmux(4) (take 2)
  
  This is a fix to the previous attempt in r281889, which some (most?)
  keyboards.
  
  Discussed with:	emaste, jkim
  
  Found by:	clang static analyzer
  CID:		1007072
  CID:		1007073
  CID:		1007074

Modified:
  head/sys/dev/kbdmux/kbdmux.c

Modified: head/sys/dev/kbdmux/kbdmux.c
==============================================================================
--- head/sys/dev/kbdmux/kbdmux.c	Wed Apr 29 15:33:55 2015	(r282225)
+++ head/sys/dev/kbdmux/kbdmux.c	Wed Apr 29 15:41:19 2015	(r282226)
@@ -470,6 +470,10 @@ kbdmux_init(int unit, keyboard_t **kbdp,
 		KBDMUX_LOCK(state);
 		callout_reset(&state->ks_timo, TICKS, kbdmux_kbd_intr_timo, state);
 		KBDMUX_UNLOCK(state);
+	} else if (needfree) {
+		free(accmap, M_KBDMUX);
+		free(fkeymap, M_KBDMUX);
+		free(keymap, M_KBDMUX);
 	}
 
 	return (0);


More information about the svn-src-all mailing list