aboutsummaryrefslogtreecommitdiffstats
path: root/libgamepad_close_device.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libgamepad_close_device.c14
1 files changed, 8 insertions, 6 deletions
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;