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

Roderick Colenbrander thunderbird2k at gmail.com
Sun Nov 15 15:37:27 CST 2009


Hi Marcus,

A couple of hours ago I submitted a patch rewrites the function. It
suffers from the same 'issue'. This and any other wgl function are
called from gdi32/opengl.c which perform magic to arrive here and in
case of wglsharelists it also performs the filtering.

Roderick

On Sun, Nov 15, 2009 at 7:28 PM, Marcus Meissner <marcus at jet.franken.de> wrote:
> 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-devel mailing list