[PATCH] user32: fixed NULL ptr checks (Coverity)

Marcus Meissner marcus at jet.franken.de
Mon Nov 23 15:14:44 CST 2009


Hi,

The NULL ptr checking is a bit off here, adjust
it to be safer.

Ciao, Marcus
---
 dlls/user32/dde_misc.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/dlls/user32/dde_misc.c b/dlls/user32/dde_misc.c
index d2de954..ae1df40 100644
--- a/dlls/user32/dde_misc.c
+++ b/dlls/user32/dde_misc.c
@@ -1983,7 +1983,13 @@ WDML_CONV*	WDML_GetConv(HCONV hConv, BOOL checkConnected)
     /* FIXME: should do better checking */
     if (pConv == NULL || pConv->magic != WDML_CONV_MAGIC) return NULL;
 
-    if (!pConv->instance || pConv->instance->threadID != GetCurrentThreadId())
+    if (!pConv->instance)
+    {
+        WARN("wrong thread ID, no instance\n");
+	return NULL;
+    }
+
+    if (pConv->instance->threadID != GetCurrentThreadId())
     {
         WARN("wrong thread ID\n");
         pConv->instance->lastError = DMLERR_INVALIDPARAMETER; /* FIXME: check */
-- 
1.5.6



More information about the wine-patches mailing list