[PATCH 1/2] mmdevapi: IsFormatSupported fills closest match iff it returns S_FALSE.

Octavian Voicu octavian.voicu at gmail.com
Thu Sep 8 10:37:54 CDT 2011


--- a/dlls/winealsa.drv/mmdevdrv.c+++ b/dlls/winealsa.drv/mmdevdrv.c>
@@ -1310,17 +1313,14 @@ exit:
>      LeaveCriticalSection(&This->lock);
>      HeapFree(GetProcessHeap(), 0, formats);
>
> -    if(hr == S_OK || !out){
> -        CoTaskMemFree(closest);
> -        if(out)
> -            *out = NULL;
> -    }else if(closest){
> +    if(hr == S_FALSE && out) {
>          closest->nBlockAlign =
>              closest->nChannels * closest->wBitsPerSample / 8;
>          closest->nAvgBytesPerSec =
>              closest->nBlockAlign * closest->nSamplesPerSec;
>          *out = closest;
> -    }
> +    } else
> +        CoTaskMemFree(closest);

You are dereferencing 'closest' without checking if it's non-NULL. It
can be NULL if control jumps to the 'exit' label for several cases.
This only applies to winealsa; for wineoss there are no gotos.

Octavian



More information about the wine-devel mailing list