From 08184b90b04961086e7b00650651188a9652a0c5 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 26 Jul 2022 16:10:41 +0200 Subject: Hide implementation details MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libgamepad_close_device.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libgamepad_close_device.c') diff --git a/libgamepad_close_device.c b/libgamepad_close_device.c index edb8361..3b00149 100644 --- a/libgamepad_close_device.c +++ b/libgamepad_close_device.c @@ -6,15 +6,17 @@ void libgamepad_close_device(struct libgamepad_device *device) { if (device) { - if (device->close_fd) - close(device->fd); - if (device->dev) - libevdev_free(device->dev); + if (device->internals) { + if (device->internals->close_fd) + close(device->fd); + if (device->internals->dev) + libevdev_free(device->internals->dev); + free(device->internals); + device->internals = NULL; + } free(device->buttons); free(device->absolute_axes); free(device->relative_axes); - device->close_fd = 0; - device->dev = NULL; device->buttons = NULL; device->absolute_axes = NULL; device->relative_axes = NULL; -- cgit v1.2.3-70-g09d2