Skip to content

Commit

Permalink
library: check return code of CloseHandle() as suggested by user
Browse files Browse the repository at this point in the history
  • Loading branch information
dontech committed Oct 24, 2021
1 parent 8b6c35d commit 609c02d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libusb/src/windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,11 @@ int usb_free_async(void **context)
return -EINVAL;
}

CloseHandle((*c)->ol.hEvent);
if (!CloseHandle((*c)->ol.hEvent))
{
USBERR("close event failed: win error: %s", usb_win_error_to_string());
return -usb_win_error_to_errno();
}

free(*c);
*c = NULL;
Expand Down

0 comments on commit 609c02d

Please sign in to comment.