[PATCH] winex11.drv: check for org = NULL (Coverity)

Marcus Meissner marcus at jet.franken.de
Sun Nov 15 12:28:47 CST 2009


Hi,

Coverity spotted some inconsistencies in "org" NULL
checking.

org originates via Windows code (I think) so we better check it.

Ciao, Marcus
---
 dlls/winex11.drv/opengl.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 45da479..774b205 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1918,11 +1918,15 @@ BOOL CDECL X11DRV_wglShareLists(HGLRC hglrc1, HGLRC hglrc2) {
 
     if (!has_opengl()) return FALSE;
 
+    if (NULL == org) {
+        ERR("Could not share display lists, original context required.\n");
+        return FALSE;
+    }
     if (NULL != dest && dest->ctx != NULL) {
-        ERR("Could not share display lists, context already created !\n");
+        ERR("Could not share display lists, context already created!\n");
         return FALSE;
     } else {
-        if(org && dest && (GetObjectType(org->hdc) == OBJ_MEMDC) ^ (GetObjectType(dest->hdc) == OBJ_MEMDC)) {
+        if(dest && (GetObjectType(org->hdc) == OBJ_MEMDC) ^ (GetObjectType(dest->hdc) == OBJ_MEMDC)) {
             WARN("Attempting to share a context between a direct and indirect rendering context, expect issues!\n");
         }
 
-- 
1.5.6



More information about the wine-patches mailing list