Author: tfaber
Date: Wed Dec 16 10:05:15 2015
New Revision: 70356
URL:
http://svn.reactos.org/svn/reactos?rev=70356&view=rev
Log:
[NTOS:PNP]
- Don't free NULL buffers returned from IopCaptureUnicodeString.
CORE-10706 #resolve
Modified:
trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/plugpla…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] Wed Dec 16 10:05:15 2015
@@ -247,7 +247,10 @@
{
/* Get the device object */
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
- ExFreePool(DeviceInstance.Buffer);
+ if (DeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(DeviceInstance.Buffer);
+ }
}
Status = IoGetDeviceInterfaces(&FilterGuid, DeviceObject, StackList.Flags,
&SymbolicLinkList);
@@ -317,14 +320,20 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- ExFreePool(DeviceInstance.Buffer);
+ if (DeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(DeviceInstance.Buffer);
+ }
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
/* Get the device object */
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
- ExFreePool(DeviceInstance.Buffer);
+ if (DeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(DeviceInstance.Buffer);
+ }
if (DeviceObject == NULL)
{
return STATUS_NO_SUCH_DEVICE;
@@ -394,7 +403,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- ExFreePool(TargetDeviceInstance.Buffer);
+ if (TargetDeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(TargetDeviceInstance.Buffer);
+ }
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
@@ -406,13 +418,19 @@
TRUE))
{
DeviceNode = IopRootDeviceNode;
- ExFreePool(TargetDeviceInstance.Buffer);
+ if (TargetDeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(TargetDeviceInstance.Buffer);
+ }
}
else
{
/* Get the device object */
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&TargetDeviceInstance);
- ExFreePool(TargetDeviceInstance.Buffer);
+ if (TargetDeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(TargetDeviceInstance.Buffer);
+ }
if (DeviceObject == NULL)
return STATUS_NO_SUCH_DEVICE;
@@ -566,14 +584,20 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- ExFreePool(DeviceInstance.Buffer);
+ if (DeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(DeviceInstance.Buffer);
+ }
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
/* Get the device object */
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
- ExFreePool(DeviceInstance.Buffer);
+ if (DeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(DeviceInstance.Buffer);
+ }
if (DeviceObject == NULL)
{
return STATUS_NO_SUCH_DEVICE;
@@ -647,7 +671,10 @@
/* Get the device object */
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
- ExFreePool(DeviceInstance.Buffer);
+ if (DeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(DeviceInstance.Buffer);
+ }
if (DeviceObject == NULL)
{
return STATUS_NO_SUCH_DEVICE;
@@ -689,7 +716,10 @@
/* Get the device object */
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
- ExFreePool(DeviceInstance.Buffer);
+ if (DeviceInstance.Buffer != NULL)
+ {
+ ExFreePool(DeviceInstance.Buffer);
+ }
if (DeviceObject == NULL)
{
return STATUS_NO_SUCH_DEVICE;