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 7e0cc7e commit c7b8b49
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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hidapi/mac/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c7b8b49

Please sign in to comment.