mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 06:05:48 +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:
parent
278ccfd7c8
commit
97d46bb600
1 changed files with 12 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue