From: bru Date: Sun, 21 Mar 2021 16:20:49 +0000 (+0000) Subject: Include wstpad allocations when cleaning up wsmouse resources. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1ab10031e6af82de1c7ba4de9be86417aa293c27;p=openbsd Include wstpad allocations when cleaning up wsmouse resources. ok gnezdo@ --- 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) {