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

Alexandre Julliard julliard at wine.codeweavers.com
Mon Sep 10 10:17:55 CDT 2007


Module: wine
Branch: master
Commit: 7144849d0b08f99d5ed245e9c801c367f8258e99
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7144849d0b08f99d5ed245e9c801c367f8258e99

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Tue Sep  4 22:58:23 2007 +0200

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

---

 dlls/dsound/buffer.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index 1a99927..5d95078 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -1023,13 +1023,16 @@ HRESULT IDirectSoundBufferImpl_Create(
 
 	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);
-	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);
 		*pdsb = NULL;
-		return DSERR_BADFORMAT;
+		if ((device->drvcaps.dwFlags & capf) != capf)
+			return DSERR_BADFORMAT;
+		return DSERR_GENERIC;
 	}
 
 	/* FIXME: check hardware sample rate mixing capabilities */




More information about the wine-cvs mailing list