Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly cast result of malloc/calloc #401

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions linux/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static __u32 detect_kernel_version(void)

static hid_device *new_hid_device(void)
{
hid_device *dev = calloc(1, sizeof(hid_device));
hid_device *dev = (hid_device *) calloc(1, sizeof(hid_device));
dev->device_handle = -1;
dev->blocking = 1;
dev->uses_numbered_reports = 0;
Expand All @@ -122,7 +122,7 @@ static wchar_t *utf8_to_wchar_t(const char *utf8)
if ((size_t) -1 == wlen) {
return wcsdup(L"");
}
ret = calloc(wlen+1, sizeof(wchar_t));
ret = (wchar_t *) calloc(wlen+1, sizeof(wchar_t));
mbstowcs(ret, utf8, wlen+1);
ret[wlen] = 0x0000;
}
Expand Down Expand Up @@ -461,7 +461,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 = malloc(sizeof(struct hid_device_info));
tmp = (hid_device_info *) malloc(sizeof(struct hid_device_info));
if (cur_dev) {
cur_dev->next = tmp;
}
Expand Down