Fixed a bug where a NULL primary buffer pointer is used when the

DirectSound object didn't create properly.
This commit is contained in:
Robert Reif 2003-07-28 19:01:20 +00:00 committed by Alexandre Julliard
parent 369116d911
commit 8c37581dd7
1 changed files with 5 additions and 1 deletions

View File

@ -716,7 +716,9 @@ static ULONG WINAPI IDirectSoundImpl_Release(LPDIRECTSOUND8 iface) {
}
RtlReleaseResource(&(This->lock));
IDirectSoundBuffer8_Release((LPDIRECTSOUNDBUFFER8)This->primary);
if (This->primary)
IDirectSoundBuffer8_Release((LPDIRECTSOUNDBUFFER8)This->primary);
hres = DSOUND_PrimaryDestroy(This);
if (hres != DS_OK)
@ -1112,6 +1114,8 @@ HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID,LPDIRECTSOUND8 *ppDS,IUnknown
err = PrimaryBuffer_Create((*ippDS), (PrimaryBufferImpl**)&((*ippDS)->primary), &((*ippDS)->dsbd));
if ((*ippDS)->primary)
IDirectSoundBuffer_AddRef((LPDIRECTSOUNDBUFFER8)(*ippDS)->primary);
else
WARN("PrimaryBuffer_Create failed\n");
return err;
}