From 895a9ab6793c77a2a49d2f7186eeaef1c43dd77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Tue, 18 Jun 2013 22:14:50 +0000 Subject: [PATCH] [WIN32K] 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reactos/win32ss/gdi/ntgdi/stockobj.c b/reactos/win32ss/gdi/ntgdi/stockobj.c index 8145956e46c..9f286b3fa00 100644 --- a/reactos/win32ss/gdi/ntgdi/stockobj.c +++ b/reactos/win32ss/gdi/ntgdi/stockobj.c @@ -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;