From 3b4909fd9424e299f8ad11fe1deec11579ed9a83 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Thu, 11 May 2017 11:05:51 +0200 Subject: [PATCH] dmusic: Set the dsound pointer to NULL on an error path. Spotted by Sebastian Lackner. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- dlls/dmusic/dmusic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/dmusic/dmusic.c b/dlls/dmusic/dmusic.c index d5d061c4018..105e6f772a2 100644 --- a/dlls/dmusic/dmusic.c +++ b/dlls/dmusic/dmusic.c @@ -298,8 +298,10 @@ static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound(IDirectMusic8 *iface, IDi return hr; hr = IDirectSound_SetCooperativeLevel(This->dsound, hwnd ? hwnd : GetForegroundWindow(), DSSCL_PRIORITY); - if (FAILED(hr)) + if (FAILED(hr)) { IDirectSound_Release(This->dsound); + This->dsound = NULL; + } return hr; }