Author: tfaber Date: Sat Aug 29 07:35:59 2015 New Revision: 68852
URL: http://svn.reactos.org/svn/reactos?rev=68852&view=rev Log: [NTOS:EX] - Remove superfluous dereference in NtCreateProfile - Allocate the right size for KPROFILE object - Don't leak the KPROFILE when deleting an EPROFILE - Avoid some casts CORE-10066
Modified: trunk/reactos/ntoskrnl/ex/profile.c
Modified: trunk/reactos/ntoskrnl/ex/profile.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/profile.c?rev=6... ============================================================================== --- trunk/reactos/ntoskrnl/ex/profile.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/profile.c [iso-8859-1] Sat Aug 29 07:35:59 2015 @@ -42,7 +42,7 @@ ULONG State;
/* Typecast the Object */ - Profile = (PEPROFILE)ObjectBody; + Profile = ObjectBody;
/* Check if there if the Profile was started */ if (Profile->LockedBufferAddress) @@ -55,6 +55,7 @@ MmUnmapLockedPages(Profile->LockedBufferAddress, Profile->Mdl); MmUnlockPages(Profile->Mdl); IoFreeMdl(Profile->Mdl); + ExFreePoolWithTag(Profile->ProfileObject, TAG_PROFILE); }
/* Check if a Process is associated and reference it */ @@ -247,7 +248,6 @@ 0, NULL, &hProfile); - ObDereferenceObject(Profile);
/* Check for Success */ if (!NT_SUCCESS(Status)) @@ -361,7 +361,7 @@
/* Allocate a Kernel Profile Object. */ ProfileObject = ExAllocatePoolWithTag(NonPagedPool, - sizeof(EPROFILE), + sizeof(*ProfileObject), TAG_PROFILE); if (!ProfileObject) { @@ -396,7 +396,7 @@ /* Initialize the Kernel Profile Object */ Profile->ProfileObject = ProfileObject; KeInitializeProfile(ProfileObject, - (PKPROCESS)Profile->Process, + &Profile->Process->Pcb, Profile->RangeBase, Profile->RangeSize, Profile->BucketSize,