From 0e9560aea22818884921e5e5064953257bfe7fa7 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 23 Jul 2019 14:41:00 -0500 Subject: [PATCH] hidapi: Zero out new hid_device_info structs --- src/hidapi/linux/hid.c | 2 +- src/hidapi/mac/hid.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hidapi/linux/hid.c b/src/hidapi/linux/hid.c index b78e009f0..28c270bae 100644 --- a/src/hidapi/linux/hid.c +++ b/src/hidapi/linux/hid.c @@ -547,7 +547,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, struct hid_device_info *tmp; /* VID/PID match. Create the record. */ - tmp = (struct hid_device_info *)malloc(sizeof(struct hid_device_info)); + tmp = (struct hid_device_info *)calloc(1, sizeof(struct hid_device_info)); if (cur_dev) { cur_dev->next = tmp; } diff --git a/src/hidapi/mac/hid.c b/src/hidapi/mac/hid.c index 7ee0fcb41..0a2c7423a 100644 --- a/src/hidapi/mac/hid.c +++ b/src/hidapi/mac/hid.c @@ -472,7 +472,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, size_t len; /* VID/PID match. Create the record. */ - tmp = (struct hid_device_info *)malloc(sizeof(struct hid_device_info)); + tmp = (struct hid_device_info *)calloc(1, sizeof(struct hid_device_info)); if (cur_dev) { cur_dev->next = tmp; }