hidapi
hidapi copied to clipboard
Add a bunch of sanity checks
Some of these changes are meant to fix a couple of warnings while reading the code. I also noticed that there were almost no sanity checks in the code, which may lead to lots of segfaults in user code.
- Win: Do not call CloseHandle in hid_open_path if device_handle is null
- Win: return errors if malloc calls fail
- Add missing NULL checks to many parameters
I think I made all the necessary changes.
NOTE: in #698 I've added some of those
If you tell me what to keep and what to remove I can adjust this soon
I guess I had too many comments/questions to this PR. Instead I prepared #727 based on this, with all my comments applied.