mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 19:26:16 +00:00
[NTFS]
Don't leak memory in case of failures in NtfsReadDisk(). Based on a patch by Trevor Thompson. CORE-10998 svn path=/trunk/; revision=71155
This commit is contained in:
@@ -87,6 +87,12 @@ NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject,
|
||||
if (Irp == NULL)
|
||||
{
|
||||
DPRINT("IoBuildSynchronousFsdRequest failed\n");
|
||||
|
||||
if (AllocatedBuffer)
|
||||
{
|
||||
ExFreePoolWithTag(ReadBuffer, TAG_NTFS);
|
||||
}
|
||||
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
@@ -108,9 +114,13 @@ NtfsReadDisk(IN PDEVICE_OBJECT DeviceObject,
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
|
||||
if (NT_SUCCESS(Status) && AllocatedBuffer)
|
||||
if (AllocatedBuffer)
|
||||
{
|
||||
RtlCopyMemory(Buffer, ReadBuffer + (StartingOffset - RealReadOffset), Length);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
RtlCopyMemory(Buffer, ReadBuffer + (StartingOffset - RealReadOffset), Length);
|
||||
}
|
||||
|
||||
ExFreePoolWithTag(ReadBuffer, TAG_NTFS);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user