[SERVICES]

- Properly invalidate service handles when closing/freeing them
Dedicated to Hermès and any regression chaser. FalsePositives--

svn path=/trunk/; revision=72396
This commit is contained in:
Jérôme Gardou 2016-08-19 22:15:53 +00:00
parent 690941472d
commit 3bae10b2bc

View file

@ -21,6 +21,7 @@
#define MANAGER_TAG 0x72674D68 /* 'hMgr' */
#define SERVICE_TAG 0x63765368 /* 'hSvc' */
#define INVALID_TAG 0xAABBCCDD
typedef struct _SCMGR_HANDLE
{
@ -952,7 +953,8 @@ DWORD RCloseServiceHandle(
{
DPRINT("Found manager handle\n");
/* FIXME: add handle cleanup code */
/* Make sure we don't access stale memory if someone tries to use this handle again. */
hManager->Handle.Tag = INVALID_TAG;
HeapFree(GetProcessHeap(), 0, hManager);
hManager = NULL;
@ -972,7 +974,8 @@ DWORD RCloseServiceHandle(
/* Get the pointer to the service record */
lpService = hService->ServiceEntry;
/* FIXME: add handle cleanup code */
/* Make sure we don't access stale memory if someone tries to use this handle again. */
hService->Handle.Tag = INVALID_TAG;
/* Free the handle */
HeapFree(GetProcessHeap(), 0, hService);