[PATCH] gdi32: handle failure in __wine_make_gdi_object_system (Coverity)

Marcus Meissner marcus at jet.franken.de
Mon Feb 9 01:33:27 CST 2009


Hi,

CID 875, GDI_GetObjPtr() can return NULL, I think even for the stock
handles in error cases. Add NULL check and ERR() output.

Ciao, Marcus
---
 dlls/gdi32/gdiobj.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c
index a67ceb3..38e4ff3 100644
--- a/dlls/gdi32/gdiobj.c
+++ b/dlls/gdi32/gdiobj.c
@@ -445,6 +445,11 @@ static const struct DefaultFontInfo default_fonts[] =
 void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set)
 {
     GDIOBJHDR *ptr = GDI_GetObjPtr( handle, 0 );
+
+    if (!ptr) {
+        ERR("System object for handle %p not found.\n", handle);
+        return;
+    }
     ptr->system = !!set;
     GDI_ReleaseObj( handle );
 }
-- 
1.5.6



More information about the wine-patches mailing list