Commit 1f882cd6 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

dsound: Fix 2 bugs in ds3d tests.

Fix 2 bugs in the error paths of the ds3d.c test (coverity).
parent df4b0a83
...@@ -739,9 +739,18 @@ static HRESULT test_secondary(LPGUID lpGuid, int play, ...@@ -739,9 +739,18 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
&listener_param); &listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() " ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc)); "failed: %s\n",DXGetErrorString8(rc));
} else {
ok(listener==NULL, "IDirectSoundBuffer_QueryInterface() "
"failed but returned a listener anyway\n");
ok(rc!=DS_OK, "IDirectSoundBuffer_QueryInterface() succeeded "
"but returned a NULL listener\n");
if (listener) {
ref=IDirectSound3DListener_Release(listener);
ok(ref==0,"IDirectSound3dListener_Release() listener has "
"%d references, should have 0\n",ref);
}
goto EXIT2;
} }
else
goto EXIT;
} }
init_format(&wfx,WAVE_FORMAT_PCM,22050,16,2); init_format(&wfx,WAVE_FORMAT_PCM,22050,16,2);
...@@ -887,18 +896,28 @@ static HRESULT test_secondary(LPGUID lpGuid, int play, ...@@ -887,18 +896,28 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
ref); ref);
} }
} }
}
EXIT1: EXIT1:
if (has_listener) { if (has_listener) {
ref=IDirectSound3DListener_Release(listener); ref=IDirectSound3DListener_Release(listener);
ok(ref==0,"IDirectSound3dListener_Release() listener has %d " ok(ref==0,"IDirectSound3dListener_Release() listener has %d "
"references, should have 0\n",ref); "references, should have 0\n",ref);
} else {
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
} else { } else {
ref=IDirectSoundBuffer_Release(primary); ok(primary==NULL,"IDirectSound_CreateSoundBuffer(primary) failed "
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " "but primary created anyway\n");
"should have 0\n",ref); ok(rc!=DS_OK,"IDirectSound_CreateSoundBuffer(primary) succeeded "
"but primary not created\n");
if (primary) {
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
} }
EXIT2:
/* Set the CooperativeLevel back to normal */ /* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment