mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 16:45:50 +00:00
[USBHUB]
- Fix memory leak in failure case of CreateDeviceIds. Patch by Víctor Martínez Calvo. CID 1102364 CORE-11208 #resolve svn path=/trunk/; revision=71301
This commit is contained in:
parent
6645a97ddb
commit
80c690a270
1 changed files with 3 additions and 1 deletions
|
@ -1035,6 +1035,9 @@ CreateDeviceIds(
|
|||
{
|
||||
// construct instance id buffer
|
||||
Index = swprintf(Buffer, L"%04d&%s", HubDeviceExtension->InstanceCount, SerialBuffer) + 1;
|
||||
|
||||
ExFreePool(SerialBuffer);
|
||||
|
||||
UsbChildExtension->usInstanceId.Buffer = (LPWSTR)ExAllocatePool(NonPagedPool, Index * sizeof(WCHAR));
|
||||
if (UsbChildExtension->usInstanceId.Buffer == NULL)
|
||||
{
|
||||
|
@ -1047,7 +1050,6 @@ CreateDeviceIds(
|
|||
//
|
||||
RtlCopyMemory(UsbChildExtension->usInstanceId.Buffer, Buffer, Index * sizeof(WCHAR));
|
||||
UsbChildExtension->usInstanceId.Length = UsbChildExtension->usInstanceId.MaximumLength = Index * sizeof(WCHAR);
|
||||
ExFreePool(SerialBuffer);
|
||||
|
||||
DPRINT("Usb InstanceId %wZ InstanceCount %x\n", &UsbChildExtension->usInstanceId, HubDeviceExtension->InstanceCount);
|
||||
return Status;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue