Check the return value of IDirectSoundImpl_Create() to detect errors.
Always set *ppDS to NULL in case of error.
This commit is contained in:
parent
0bbe91213d
commit
1426632839
|
@ -757,6 +757,7 @@ HRESULT WINAPI IDirectSoundImpl_Create(
|
||||||
|
|
||||||
if (found == FALSE) {
|
if (found == FALSE) {
|
||||||
WARN("No device found matching given ID!\n");
|
WARN("No device found matching given ID!\n");
|
||||||
|
*ppDS = NULL;
|
||||||
return DSERR_NODRIVER;
|
return DSERR_NODRIVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1641,7 +1642,7 @@ HRESULT WINAPI DSOUND_Create(
|
||||||
} else {
|
} else {
|
||||||
LPDIRECTSOUND8 pDS;
|
LPDIRECTSOUND8 pDS;
|
||||||
hr = IDirectSoundImpl_Create(&devGuid, &pDS);
|
hr = IDirectSoundImpl_Create(&devGuid, &pDS);
|
||||||
if (pDS) {
|
if (hr == DS_OK) {
|
||||||
hr = DSOUND_PrimaryCreate((IDirectSoundImpl*)pDS);
|
hr = DSOUND_PrimaryCreate((IDirectSoundImpl*)pDS);
|
||||||
if (hr == DS_OK) {
|
if (hr == DS_OK) {
|
||||||
hr = IDirectSound_IDirectSound_Create(pDS, ppDS);
|
hr = IDirectSound_IDirectSound_Create(pDS, ppDS);
|
||||||
|
@ -1746,7 +1747,7 @@ HRESULT WINAPI DSOUND_Create8(
|
||||||
} else {
|
} else {
|
||||||
LPDIRECTSOUND8 pDS;
|
LPDIRECTSOUND8 pDS;
|
||||||
hr = IDirectSoundImpl_Create(&devGuid, &pDS);
|
hr = IDirectSoundImpl_Create(&devGuid, &pDS);
|
||||||
if (pDS) {
|
if (hr == DS_OK) {
|
||||||
hr = DSOUND_PrimaryCreate((IDirectSoundImpl*)pDS);
|
hr = DSOUND_PrimaryCreate((IDirectSoundImpl*)pDS);
|
||||||
if (hr == DS_OK) {
|
if (hr == DS_OK) {
|
||||||
hr = IDirectSound8_IDirectSound8_Create(pDS, ppDS);
|
hr = IDirectSound8_IDirectSound8_Create(pDS, ppDS);
|
||||||
|
|
Loading…
Reference in New Issue