dsound: Fix null pointer dereference for waveout in creating buffer.

This commit is contained in:
Maarten Lankhorst 2007-09-04 22:58:23 +02:00 committed by Alexandre Julliard
parent 985df9cdf0
commit 7144849d0b
1 changed files with 6 additions and 3 deletions

View File

@ -1023,13 +1023,16 @@ HRESULT IDirectSoundBufferImpl_Create(
use_hw = !!(dsbd->dwFlags & DSBCAPS_LOCHARDWARE); use_hw = !!(dsbd->dwFlags & DSBCAPS_LOCHARDWARE);
TRACE("use_hw = %d, capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n", use_hw, capf, device->drvcaps.dwFlags); TRACE("use_hw = %d, capf = 0x%08x, device->drvcaps.dwFlags = 0x%08x\n", use_hw, capf, device->drvcaps.dwFlags);
if (use_hw && (device->drvcaps.dwFlags & capf) != capf) if (use_hw && ((device->drvcaps.dwFlags & capf) != capf || !device->driver))
{ {
WARN("Format not supported for hardware buffer\n"); if (device->driver)
WARN("Format not supported for hardware buffer\n");
HeapFree(GetProcessHeap(),0,dsb->pwfx); HeapFree(GetProcessHeap(),0,dsb->pwfx);
HeapFree(GetProcessHeap(),0,dsb); HeapFree(GetProcessHeap(),0,dsb);
*pdsb = NULL; *pdsb = NULL;
return DSERR_BADFORMAT; if ((device->drvcaps.dwFlags & capf) != capf)
return DSERR_BADFORMAT;
return DSERR_GENERIC;
} }
/* FIXME: check hardware sample rate mixing capabilities */ /* FIXME: check hardware sample rate mixing capabilities */