From 4165d4915e3b2134da77affc3387599075f68edd Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Sun, 21 May 2023 11:12:26 +0300 Subject: [PATCH] Fix "Use after free" Fixes: #542 --- linux/hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/hid.c b/linux/hid.c index dda9f597a..0bba56db2 100644 --- a/linux/hid.c +++ b/linux/hid.c @@ -1007,7 +1007,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path) res = ioctl(dev->device_handle, HIDIOCGRDESCSIZE, &desc_size); if (res < 0) { hid_close(dev); - register_device_error_format(dev, "ioctl(GRDESCSIZE) error for '%s', not a HIDRAW device?: %s", path, strerror(errno)); + register_global_error_format("ioctl(GRDESCSIZE) error for '%s', not a HIDRAW device?: %s", path, strerror(errno)); return NULL; }