summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorFrederic Cambus <fcambus@cvs.openbsd.org>2018-01-22 12:20:55 +0000
committerFrederic Cambus <fcambus@cvs.openbsd.org>2018-01-22 12:20:55 +0000
commitea02d263355d87cbde54750af717b2d9b86f9fda (patch)
tree3373cac4d85f4f7c0acf87f73c0cc2eb786d3843 /sys/dev
parent21f056509bef58cc89a78dd6497496e80ff97799 (diff)
More sizes for free() in wscons(4).
OK visa@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/wscons/wskbd.c5
-rw-r--r--sys/dev/wscons/wskbdutil.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index 7316b2e60d1..304d5a92057 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbd.c,v 1.88 2018/01/17 16:54:19 fcambus Exp $ */
+/* $OpenBSD: wskbd.c,v 1.89 2018/01/22 12:20:54 fcambus Exp $ */
/* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */
/*
@@ -629,7 +629,8 @@ wskbd_detach(struct device *self, int flags)
splx(s);
}
- free(sc->sc_map, M_DEVBUF, 0);
+ free(sc->sc_map, M_DEVBUF,
+ sc->sc_maplen * sizeof(struct wscons_keymap));
/* locate the major number */
for (maj = 0; maj < nchrdev; maj++)
diff --git a/sys/dev/wscons/wskbdutil.c b/sys/dev/wscons/wskbdutil.c
index f1d108fca1d..c2b553186eb 100644
--- a/sys/dev/wscons/wskbdutil.c
+++ b/sys/dev/wscons/wskbdutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbdutil.c,v 1.16 2017/09/08 05:36:53 deraadt Exp $ */
+/* $OpenBSD: wskbdutil.c,v 1.17 2018/01/22 12:20:54 fcambus Exp $ */
/* $NetBSD: wskbdutil.c,v 1.7 1999/12/21 11:59:13 drochner Exp $ */
/*-
@@ -383,7 +383,8 @@ wskbd_init_keymap(int newlen, struct wscons_keymap **map, int *maplen)
if (newlen != *maplen) {
if (*maplen > 0)
- free(*map, M_DEVBUF, 0);
+ free(*map, M_DEVBUF,
+ *maplen * sizeof(struct wscons_keymap));
*maplen = newlen;
*map = mallocarray(newlen, sizeof(struct wscons_keymap),
M_DEVBUF, M_WAITOK);