Author: tkreuzer
Date: Sun Apr 5 12:45:01 2015
New Revision: 67060
URL:
http://svn.reactos.org/svn/reactos?rev=67060&view=rev
Log:
[WIN32K]
Allocate the device lock semaphore for a PDEVOBJ in PDEVOBJ_AllocPDEV and implement
PDEVOBJ_vDeletePDEV. Fixes a PDEVOBJ leak, found by Thomas and Giannis.
Modified:
trunk/reactos/win32ss/gdi/eng/pdevobj.c
Modified: trunk/reactos/win32ss/gdi/eng/pdevobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/pdevobj.c?…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] Sun Apr 5 12:45:01 2015
@@ -60,9 +60,25 @@
RtlZeroMemory(ppdev, sizeof(PDEVOBJ));
+ ppdev->hsemDevLock = EngCreateSemaphore();
+ if (ppdev->hsemDevLock == NULL)
+ {
+ ExFreePoolWithTag(ppdev, GDITAG_PDEV);
+ return NULL;
+ }
+
ppdev->cPdevRefs = 1;
return ppdev;
+}
+
+static
+VOID
+PDEVOBJ_vDeletePDEV(
+ PPDEVOBJ ppdev)
+{
+ EngDeleteSemaphore(ppdev->hsemDevLock);
+ ExFreePoolWithTag(ppdev, GDITAG_PDEV);
}
VOID
@@ -124,7 +140,7 @@
gppdevPrimary = NULL;
/* Free it */
- ExFreePoolWithTag(ppdev, GDITAG_PDEV );
+ PDEVOBJ_vDeletePDEV(ppdev);
}
/* Unlock loader */
@@ -323,7 +339,7 @@
DPRINT1("Could not load display driver '%ls',
'%ls'\n",
pGraphicsDevice->pDiplayDrivers,
pdm->dmDeviceName);
- ExFreePoolWithTag(ppdev, GDITAG_PDEV);
+ PDEVOBJ_vRelease(ppdev);
return NULL;
}
@@ -336,7 +352,6 @@
ppdev->pfnMovePointer = EngMovePointer;
ppdev->pGraphicsDevice = pGraphicsDevice;
- ppdev->hsemDevLock = EngCreateSemaphore();
// Should we change the ative mode of pGraphicsDevice ?
ppdev->pdmwDev = PDEVOBJ_pdmMatchDevMode(ppdev, pdm) ;