Author: hbelusca Date: Sun Nov 9 02:26:49 2014 New Revision: 65337
URL: http://svn.reactos.org/svn/reactos?rev=65337&view=rev Log: [NTOS:PNPMGR] - Remove an unneeded ExFreePool(DeviceInstance.Buffer); call in IopGetInterfaceDeviceList because at this point DeviceInstance is not yet initialized. Fixes MSVC build. - No need to check for DeviceInstance.Buffer being NULL or not (in IopDeviceStatus), because in case it was NULL the IopCaptureUnicodeString call already failed. - Add some brackets to conform to code style.
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/plugplay... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/plugplay.c [iso-8859-1] Sun Nov 9 02:26:49 2014 @@ -199,8 +199,7 @@ } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - if (Name.Buffer) - ExFreePool(Name.Buffer); + if (Name.Buffer) ExFreePool(Name.Buffer); Status = _SEH2_GetExceptionCode(); } _SEH2_END; @@ -232,7 +231,6 @@ } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - ExFreePool(DeviceInstance.Buffer); _SEH2_YIELD(return _SEH2_GetExceptionCode()); } _SEH2_END; @@ -533,7 +531,9 @@
Status = IopCaptureUnicodeString(&DeviceInstance, &StatusData->DeviceInstance); if (!NT_SUCCESS(Status)) + { return Status; + } DPRINT("Device name: '%wZ'\n", &DeviceInstance);
_SEH2_TRY @@ -547,7 +547,7 @@ } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - if (DeviceInstance.Buffer) ExFreePool(DeviceInstance.Buffer); + ExFreePool(DeviceInstance.Buffer); _SEH2_YIELD(return _SEH2_GetExceptionCode()); } _SEH2_END; @@ -556,7 +556,9 @@ DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance); ExFreePool(DeviceInstance.Buffer); if (DeviceObject == NULL) + { return STATUS_NO_SUCH_DEVICE; + }
DeviceNode = IopGetDeviceNode(DeviceObject);
@@ -618,7 +620,9 @@ DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance); ExFreePool(DeviceInstance.Buffer); if (DeviceObject == NULL) + { return STATUS_NO_SUCH_DEVICE; + }
DeviceNode = IopGetDeviceNode(DeviceObject);
@@ -648,15 +652,18 @@
Status = IopCaptureUnicodeString(&DeviceInstance, &ResetDeviceData->DeviceInstance); if (!NT_SUCCESS(Status)) + { return Status; - + } DPRINT("IopResetDevice(%wZ)\n", &DeviceInstance);
/* Get the device object */ DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance); ExFreePool(DeviceInstance.Buffer); if (DeviceObject == NULL) + { return STATUS_NO_SUCH_DEVICE; + }
/* Get the device node */ DeviceNode = IopGetDeviceNode(DeviceObject);