Re: [PATCH 1/2] mmdevapi: IsFormatSupported fills closest match iff it returns S_FALSE.
--- 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
On Thu, Sep 8, 2011 at 6:37 PM, Octavian Voicu <octavian.voicu(a)gmail.com> wrote:
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.
Disregard that, I see now that hr is S_FALSE only when closest is non-NULL. Sorry for the noise. Octavian
participants (1)
-
Octavian Voicu