[PATCH] check return value of get_dc_ptr()

Marcus Meissner marcus at jet.franken.de
Tue Oct 2 14:07:13 CDT 2007


Hi,

Coverity spotted a potential NULL deref,
since the call lacks return checking.
I agree.

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

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



More information about the wine-patches mailing list