[PATCH] gdi32: check dcs for NULL and exit (Coverity)

Marcus Meissner marcus at jet.franken.de
Fri Jan 30 12:48:49 CST 2009


Hi,

CID 617, get_dc_ptr() might return NULL in some cases,
added check.

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

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 2032dfa..f44e170 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -567,6 +567,12 @@ INT WINAPI SaveDC( HDC hdc )
         return 0;
     }
     dcs = get_dc_ptr( hdcs );
+    if (!dcs)
+    {
+        release_dc_ptr( dc );
+        DeleteDC( hdcs );
+        return 0;
+    }
 
     /* Copy path. The reason why path saving / restoring is in SaveDC/
      * RestoreDC and not in GetDCState/SetDCState is that the ...DCState
-- 
1.5.6



More information about the wine-patches mailing list