Missing LeaveCriticalSection on error paths (found by Smatch).

Michael Stefaniuc mstefani at redhat.com
Fri Jun 2 14:59:42 CDT 2006


Michael Stefaniuc wrote:
> can somebody more familiar with this code confirm that on the error
> paths the CriticalSection should be released? I'm not sure about it as
> the function is supposed to keep the lock held when exiting without
> error; there is a d3ddevice_unlock_update() function that releases the
> lock.
Asked Lionel Ulmer on irc and the patch is correct. But according to
Stefan Dösinger that code will be replaced by his code "in the next
couple of days".

bye
	michael

> ---
> 
>  dlls/ddraw/device_opengl.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> dd0b9b20d26984ae408c1a7727323a08d44e0d95
> diff --git a/dlls/ddraw/device_opengl.c b/dlls/ddraw/device_opengl.c
> index d19996e..4c663a6 100644
> --- a/dlls/ddraw/device_opengl.c
> +++ b/dlls/ddraw/device_opengl.c
> @@ -3775,10 +3775,12 @@ static void d3ddevice_lock_update(IDirec
>  		buffer_color = GL_BGRA;
>  	    } else {
>  		ERR(" unsupported pixel format at device locking.\n");
> +                LeaveCriticalSection(&(d3d_dev->crit));
>  		return;
>  	    }
>  	} else {
>  	    ERR(" unsupported pixel format at device locking - alpha on frame buffer.\n");
> +            LeaveCriticalSection(&(d3d_dev->crit));
>  	    return;
>  	}
>  
> 
> 
> ------------------------------------------------------------------------
> 
> 


-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
Sr. Network Engineer            Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani at redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart



More information about the wine-devel mailing list