Peter Urbanec : wintab32: Check for NULL before using context.

Alexandre Julliard julliard at winehq.org
Wed Jan 7 10:57:14 CST 2009


Module: wine
Branch: master
Commit: 65b3393dce9fb5ea6192c787809f543a84b49f4c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=65b3393dce9fb5ea6192c787809f543a84b49f4c

Author: Peter Urbanec <winehq.org at urbanec.net>
Date:   Wed Jan  7 10:46:04 2009 +1100

wintab32: Check for NULL before using context.

---

 dlls/wintab32/context.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/wintab32/context.c b/dlls/wintab32/context.c
index f52d8d2..6b52c08 100644
--- a/dlls/wintab32/context.c
+++ b/dlls/wintab32/context.c
@@ -685,6 +685,12 @@ BOOL WINAPI WTOverlap(HCTX hCtx, BOOL fToTop)
 
     EnterCriticalSection(&csTablet);
     context = TABLET_FindOpenContext(hCtx);
+    if (!context)
+    {
+        LeaveCriticalSection(&csTablet);
+        return FALSE;
+    }
+
     /* if we want to send to top and it's not already there */
     if (fToTop && context->context.lcStatus != CXS_ONTOP)
     {
@@ -777,6 +783,12 @@ BOOL WINAPI WTSetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx)
 
     EnterCriticalSection(&csTablet);
     context = TABLET_FindOpenContext(hCtx);
+    if (!context)
+    {
+        LeaveCriticalSection(&csTablet);
+        return FALSE;
+    }
+
     LOGCONTEXTAtoW(lpLogCtx, &context->context);
     LeaveCriticalSection(&csTablet);
 
@@ -799,6 +811,12 @@ BOOL WINAPI WTSetW(HCTX hCtx, LPLOGCONTEXTW lpLogCtx)
 
     EnterCriticalSection(&csTablet);
     context = TABLET_FindOpenContext(hCtx);
+    if (!context)
+    {
+        LeaveCriticalSection(&csTablet);
+        return FALSE;
+    }
+
     memmove(&context->context, lpLogCtx, sizeof(LOGCONTEXTW));
     LeaveCriticalSection(&csTablet);
 




More information about the wine-cvs mailing list