[WIN32K]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 18 Jun 2013 22:14:50 +0000 (22:14 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 18 Jun 2013 22:14:50 +0000 (22:14 +0000)
Check for NULL pointer returned by PEN_AllocPenWithHandle before dereferencing the returned pointer (the allocation function can return NULL in low memory conditions, leading to kernel crashes).

svn path=/trunk/; revision=59257

reactos/win32ss/gdi/ntgdi/stockobj.c

index 8145956..9f286b3 100644 (file)
@@ -107,7 +107,10 @@ IntCreateStockPen(DWORD dwPenStyle,
                   ULONG ulColor)
 {
     HPEN hPen;
-    PBRUSH pbrushPen = PEN_AllocPenWithHandle();
+    PBRUSH pbrushPen;
+
+    pbrushPen = PEN_AllocPenWithHandle();
+    if (pbrushPen == NULL) return NULL;
 
     if ((dwPenStyle & PS_STYLE_MASK) == PS_NULL) dwWidth = 1;