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
This commit is contained in:
Pedro F. Giffuni 2015-04-29 15:41:19 +00:00
parent 85ffc58684
commit 3b7176c90a

View File

@ -470,6 +470,10 @@ kbdmux_init(int unit, keyboard_t **kbdp, void *arg, int flags)
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);