diff options
author | Ulf Brosziewski <bru@cvs.openbsd.org> | 2021-03-21 16:20:50 +0000 |
---|---|---|
committer | Ulf Brosziewski <bru@cvs.openbsd.org> | 2021-03-21 16:20:50 +0000 |
commit | 188edf1f27f267572d236c1c49376bbde7e6aeaa (patch) | |
tree | 22e834889898f5c50b7bc812d2750a58cd6c43c3 | |
parent | 038cd7b3566b7ecb92dd6e25024d928866e91d55 (diff) |
Include wstpad allocations when cleaning up wsmouse resources.
ok gnezdo@
-rw-r--r-- | sys/dev/wscons/wsmouse.c | 5 | ||||
-rw-r--r-- | sys/dev/wscons/wsmouseinput.h | 3 | ||||
-rw-r--r-- | sys/dev/wscons/wstpad.c | 15 |
3 files changed, 20 insertions, 3 deletions
diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c index 6692c724366..426e8de0755 100644 --- a/sys/dev/wscons/wsmouse.c +++ b/sys/dev/wscons/wsmouse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmouse.c,v 1.66 2020/07/29 05:53:52 anton Exp $ */ +/* $OpenBSD: wsmouse.c,v 1.67 2021/03/21 16:20:49 bru Exp $ */ /* $NetBSD: wsmouse.c,v 1.35 2005/02/27 00:27:52 perry Exp $ */ /* @@ -1712,5 +1712,8 @@ wsmouse_input_reset(struct wsmouseinput *input) void wsmouse_input_cleanup(struct wsmouseinput *input) { + if (input->tp != NULL) + wstpad_cleanup(input); + free_mt_slots(input); } diff --git a/sys/dev/wscons/wsmouseinput.h b/sys/dev/wscons/wsmouseinput.h index 5cba98ce4a8..5665fe4cfd5 100644 --- a/sys/dev/wscons/wsmouseinput.h +++ b/sys/dev/wscons/wsmouseinput.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmouseinput.h,v 1.14 2019/08/19 21:19:38 bru Exp $ */ +/* $OpenBSD: wsmouseinput.h,v 1.15 2021/03/21 16:20:49 bru Exp $ */ /* * Copyright (c) 2015, 2016 Ulf Brosziewski @@ -193,6 +193,7 @@ void wstpad_compat_convert(struct wsmouseinput *, struct evq_access *); void wstpad_init_deceleration(struct wsmouseinput *); int wstpad_configure(struct wsmouseinput *); void wstpad_reset(struct wsmouseinput *); +void wstpad_cleanup(struct wsmouseinput *); int wstpad_get_param(struct wsmouseinput *, int, int *); int wstpad_set_param(struct wsmouseinput *, int, int); diff --git a/sys/dev/wscons/wstpad.c b/sys/dev/wscons/wstpad.c index 9e89bb04762..ccd2b4ba4b2 100644 --- a/sys/dev/wscons/wstpad.c +++ b/sys/dev/wscons/wstpad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wstpad.c,v 1.27 2021/03/03 19:44:37 bru Exp $ */ +/* $OpenBSD: wstpad.c,v 1.28 2021/03/21 16:20:49 bru Exp $ */ /* * Copyright (c) 2015, 2016 Ulf Brosziewski @@ -1670,6 +1670,19 @@ wstpad_reset(struct wsmouseinput *input) } } +void +wstpad_cleanup(struct wsmouseinput *input) +{ + struct wstpad *tp = input->tp; + int slots; + + timeout_del(&tp->tap.to); + slots = imax(input->mt.num_slots, 1); + free(tp->tpad_touches, M_DEVBUF, slots * sizeof(struct tpad_touch)); + free(tp, M_DEVBUF, sizeof(struct wstpad)); + input->tp = NULL; +} + int wstpad_set_param(struct wsmouseinput *input, int key, int val) { |