[ros-diffs] [cgutman] 46285: [NTOSKRNL] - Fix a memory leak of the allocated IO_STATUS_BLOCK - Don't free unallocated memory - Send the IRP with the correct MajorFunction - Use IoBuildAsynchronousFsdRequest instead of IoBuildSynchronousFsdRequest (fixes potiential null pointer access when attempting to set the wait event which is NULL) - Set the correct stack parameters for the IRPs
cgutman at svn.reactos.org
cgutman at svn.reactos.org
Sat Mar 20 17:48:01 CET 2010
- Previous message: [ros-diffs] [akhaldi] 46284: [XDK] - Move several definitions to their appropriate places. - Add FIELD_OFFSET, FIELD_SIZE, POOL_TAGGING, IF_DEBUG, IF_NTOS_DEBUG, LOOKASIDE_CHECK, KIPI_COUNTS, KTIMER_ACTUAL_LENGTH, LOGICAL_PROCESSOR_RELATIONSHIP, LTP_PC_SMT, SYSTEM_LOGICAL_PROCESSOR_INFORMATION, NUMA_NODE_RELATIONSHIP, GROUP_RELATIONSHIP, SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, SINGLE_GROUP_LEGACY_API, KMESSAGE_SERVICE_ROUTINE, KSEMAPHORE_ACTUAL_LENGTH and several missing CACHE_*, PROCESSOR_* and KAPC_* definitions. - Group some related definitions. - Base several ASSERT_* macros on NT_ASSERT instead of ASSERT. [WDM] - Update wdm.h to reflect XDK changes.
- Next message: [ros-diffs] [cgutman] 46286: - Fix build
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: cgutman
Date: Sat Mar 20 17:48:00 2010
New Revision: 46285
URL: http://svn.reactos.org/svn/reactos?rev=46285&view=rev
Log:
[NTOSKRNL]
- Fix a memory leak of the allocated IO_STATUS_BLOCK
- Don't free unallocated memory
- Send the IRP with the correct MajorFunction
- Use IoBuildAsynchronousFsdRequest instead of IoBuildSynchronousFsdRequest (fixes potiential null pointer access when attempting to set the wait event which is NULL)
- Set the correct stack parameters for the IRPs
Modified:
trunk/reactos/ntoskrnl/po/power.c
Modified: trunk/reactos/ntoskrnl/po/power.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/po/power.c?rev=46285&r1=46284&r2=46285&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/po/power.c [iso-8859-1] Sat Mar 20 17:48:00 2010
@@ -47,9 +47,10 @@
RequestPowerItem->PowerState,
RequestPowerItem->Context,
&Irp->IoStatus);
-
- ExFreePool(&Irp->IoStatus);
+
ExFreePool(Context);
+
+ IoFreeIrp(Irp);
return STATUS_SUCCESS;
}
@@ -358,7 +359,6 @@
PDEVICE_OBJECT TopDeviceObject;
PIO_STACK_LOCATION Stack;
PIRP Irp;
- PIO_STATUS_BLOCK IoStatusBlock;
PREQUEST_POWER_ITEM RequestPowerItem;
NTSTATUS Status;
@@ -370,27 +370,19 @@
RequestPowerItem = ExAllocatePool(NonPagedPool, sizeof(REQUEST_POWER_ITEM));
if (!RequestPowerItem)
return STATUS_INSUFFICIENT_RESOURCES;
- IoStatusBlock = ExAllocatePool(NonPagedPool, sizeof(IO_STATUS_BLOCK));
- if (!IoStatusBlock)
- {
- ExFreePool(RequestPowerItem);
- return STATUS_INSUFFICIENT_RESOURCES;
- }
/* Always call the top of the device stack */
TopDeviceObject = IoGetAttachedDeviceReference(DeviceObject);
- Irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP,
- TopDeviceObject,
- NULL,
- 0,
- NULL,
- NULL,
- IoStatusBlock);
+ Irp = IoBuildAsynchronousFsdRequest(IRP_MJ_POWER,
+ TopDeviceObject,
+ NULL,
+ 0,
+ NULL,
+ NULL);
if (!Irp)
{
ExFreePool(RequestPowerItem);
- ExFreePool(IoStatusBlock);
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -404,7 +396,10 @@
if (MinorFunction == IRP_MN_WAIT_WAKE)
Stack->Parameters.WaitWake.PowerState = PowerState.SystemState;
else
- Stack->Parameters.WaitWake.PowerState = PowerState.DeviceState;
+ {
+ Stack->Parameters.Power.Type = DevicePowerState;
+ Stack->Parameters.Power.State = PowerState.DeviceState;
+ }
RequestPowerItem->CompletionRoutine = CompletionFunction;
RequestPowerItem->PowerState = PowerState;
- Previous message: [ros-diffs] [akhaldi] 46284: [XDK] - Move several definitions to their appropriate places. - Add FIELD_OFFSET, FIELD_SIZE, POOL_TAGGING, IF_DEBUG, IF_NTOS_DEBUG, LOOKASIDE_CHECK, KIPI_COUNTS, KTIMER_ACTUAL_LENGTH, LOGICAL_PROCESSOR_RELATIONSHIP, LTP_PC_SMT, SYSTEM_LOGICAL_PROCESSOR_INFORMATION, NUMA_NODE_RELATIONSHIP, GROUP_RELATIONSHIP, SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, SINGLE_GROUP_LEGACY_API, KMESSAGE_SERVICE_ROUTINE, KSEMAPHORE_ACTUAL_LENGTH and several missing CACHE_*, PROCESSOR_* and KAPC_* definitions. - Group some related definitions. - Base several ASSERT_* macros on NT_ASSERT instead of ASSERT. [WDM] - Update wdm.h to reflect XDK changes.
- Next message: [ros-diffs] [cgutman] 46286: - Fix build
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Ros-diffs
mailing list