diff --git a/reactos/ntoskrnl/io/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr.c index bc30f00906e..5eaf416b24b 100644 --- a/reactos/ntoskrnl/io/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr.c @@ -322,15 +322,18 @@ IoGetDeviceProperty( *ResultLength = ValueInformation->DataLength; ZwClose(KeyHandle); - if (ValueInformation->DataLength > BufferLength) - Status = STATUS_BUFFER_TOO_SMALL; - if (!NT_SUCCESS(Status)) { ExFreePool(ValueInformation); return Status; } + if (ValueInformation->DataLength > BufferLength) + { + ExFreePool(ValueInformation); + return STATUS_BUFFER_TOO_SMALL; + } + /* FIXME: Verify the value (NULL-terminated, correct format). */ RtlCopyMemory(PropertyBuffer, ValueInformation->Data,