Skip to content

Commit

Permalink
hidapi: Zero out new hid_device_info structs
Browse files Browse the repository at this point in the history
  • Loading branch information
aeikum committed Jul 23, 2019
1 parent bf9bf60 commit 0e9560a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/hidapi/linux/hid.c
Expand Up @@ -547,7 +547,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
struct hid_device_info *tmp; struct hid_device_info *tmp;


/* VID/PID match. Create the record. */ /* 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) { if (cur_dev) {
cur_dev->next = tmp; cur_dev->next = tmp;
} }
Expand Down
2 changes: 1 addition & 1 deletion src/hidapi/mac/hid.c
Expand Up @@ -472,7 +472,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
size_t len; size_t len;


/* VID/PID match. Create the record. */ /* 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) { if (cur_dev) {
cur_dev->next = tmp; cur_dev->next = tmp;
} }
Expand Down

0 comments on commit 0e9560a

Please sign in to comment.