Author: mjmartin
Date: Tue Apr 27 15:41:37 2010
New Revision: 47049
URL:
http://svn.reactos.org/svn/reactos?rev=47049&view=rev
Log:
[ntoskrnl/io]
- Check for null pointers before attempting to copy or free memory.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/deviface.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/deviface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/deviface…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/deviface.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/deviface.c [iso-8859-1] Tue Apr 27 15:41:37 2010
@@ -884,7 +884,8 @@
NextReferenceString:
ExFreePool(ReferenceBi);
ReferenceBi = NULL;
- ExFreePool(bip);
+ if (bip)
+ ExFreePool(bip);
bip = NULL;
if (ReferenceKey != INVALID_HANDLE_VALUE)
{
@@ -921,8 +922,11 @@
Status = STATUS_INSUFFICIENT_RESOURCES;
goto cleanup;
}
- RtlCopyMemory(NewBuffer, ReturnBuffer.Buffer, ReturnBuffer.Length);
- ExFreePool(ReturnBuffer.Buffer);
+ if (ReturnBuffer.Buffer)
+ {
+ RtlCopyMemory(NewBuffer, ReturnBuffer.Buffer, ReturnBuffer.Length);
+ ExFreePool(ReturnBuffer.Buffer);
+ }
ReturnBuffer.Buffer = NewBuffer;
}
ReturnBuffer.Buffer[ReturnBuffer.Length / sizeof(WCHAR)] = UNICODE_NULL;