vlovich/hidapi — comment on commit dc6ca22775e4a8d9249b710a1a86b6df0050f569
File:  line 0
By vlovich:

There's no way to get the output hid-report size as the user of the API (& I haven't investigated on whether or not that's exposed on all platforms) so I don't think it's unreasonable to have the underlying layer be responsible for padding (the malloc cost btw is the least expensive part btw - the I/O is going to dominate that operation).

Regarding the read, the problem I believe was something like I was seeing corruption in the buffer... I'm not sure anymore if it's actually the correct fix. I should revisit it.

Can you clarify where you see the race condition added? I'm not changing the buffer access pattern, so if there's a race condition, it's already present in the code.