Skip to content

Commit

Permalink
transfer: avoid a potential double free that gets asserted in rare cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dontech committed Feb 13, 2024
1 parent 96cbcd3 commit 4283b1b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions libusb/src/driver/transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,9 @@ NTSTATUS transfer(libusb_device_t* dev,
goto transfer_free;
}

/* Do not check this status code, as the request might complete during call,
so we do *not* want to free anything here as that would lead to double-free */
status = transfer_next(dev, irp, context);
if (!NT_SUCCESS(status))
{
goto transfer_free;
}

InterlockedExchange(&dev->pending_busy[endpoint->address], 0);
return status;
Expand Down

0 comments on commit 4283b1b

Please sign in to comment.