Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
may as well check return value from report->map() too
Browse files Browse the repository at this point in the history
  • Loading branch information
btoews committed Jun 19, 2018
1 parent a4fc765 commit 9f4ff58
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions SoftU2FDriver/SoftU2FUserClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ void SoftU2FUserClient::frameReceived(IOMemoryDescriptor *report) {
void SoftU2FUserClient::frameReceivedGated(IOMemoryDescriptor *report) {
IOLog("%s[%p]::%s(%p)\n", getName(), this, __FUNCTION__, report);

IOMemoryMap *reportMap;
io_user_reference_t *args;
IOMemoryMap *reportMap = nullptr;

if (isInactive() || !_notifyRef)
return;
Expand All @@ -168,11 +167,13 @@ void SoftU2FUserClient::frameReceivedGated(IOMemoryDescriptor *report) {
// Map report into kernel space.
reportMap = report->map();

// Notify userland that we got a report.
args = (io_user_reference_t *)reportMap->getAddress();
sendAsyncResult64(*_notifyRef, kIOReturnSuccess, args, sizeof(U2FHID_FRAME) / sizeof(io_user_reference_t));
if (reportMap != nullptr) {
// Notify userland that we got a report.
io_user_reference_t *args = (io_user_reference_t *)reportMap->getAddress();
sendAsyncResult64(*_notifyRef, kIOReturnSuccess, args, sizeof(U2FHID_FRAME) / sizeof(io_user_reference_t));
reportMap->release();
}

reportMap->release();
report->complete();
}

Expand Down

0 comments on commit 9f4ff58

Please sign in to comment.