Skip to content

Commit

Permalink
Fix double-callback-call crash in //services/device/hid/
Browse files Browse the repository at this point in the history
Fix use-after-move (potential) bugs found by the
"bugprone-use-after-move" clang-tidy check.

Bug: 1122844
Change-Id: Ifbac49491ff181550f23b4bd611eb0f28e470688
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2602289
Auto-Submit: Maksim Ivanov <emaxx@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Reviewed-by: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840349}
  • Loading branch information
Maksim Ivanov authored and Chromium LUCI CQ committed Jan 5, 2021
1 parent c83fe85 commit bdef99c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions services/device/hid/hid_connection_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ void HidConnectionWin::PlatformWrite(
if (!IsValidHandle(file_handle)) {
HID_LOG(DEBUG) << "HID write failed due to invalid handle.";
std::move(callback).Run(false);
return;
}

transfers_.push_back(std::make_unique<PendingHidTransfer>(
Expand All @@ -170,6 +171,7 @@ void HidConnectionWin::PlatformGetFeatureReport(uint8_t report_id,
if (!IsValidHandle(file_handle)) {
HID_LOG(DEBUG) << "HID read failed due to invalid handle.";
std::move(callback).Run(false, nullptr, 0);
return;
}

transfers_.push_back(std::make_unique<PendingHidTransfer>(
Expand Down

0 comments on commit bdef99c

Please sign in to comment.