[dsound] Fix 2 bugs in ds3d tests (coverity)
Robert Reif
reif at earthlink.net
Sat Apr 8 22:48:05 CDT 2006
Fix 2 bugs in the error paths of the ds3d.c test.
-------------- next part --------------
Index: dlls/dsound/tests/ds3d.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/ds3d.c,v
retrieving revision 1.34
diff -p -u -r1.34 ds3d.c
--- dlls/dsound/tests/ds3d.c 15 Mar 2006 11:13:45 -0000 1.34
+++ dlls/dsound/tests/ds3d.c 9 Apr 2006 03:44:03 -0000
@@ -739,9 +739,18 @@ static HRESULT test_secondary(LPGUID lpG
&listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
"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);
@@ -887,18 +896,28 @@ static HRESULT test_secondary(LPGUID lpG
ref);
}
}
- }
EXIT1:
- if (has_listener) {
- ref=IDirectSound3DListener_Release(listener);
- ok(ref==0,"IDirectSound3dListener_Release() listener has %d "
- "references, should have 0\n",ref);
+ if (has_listener) {
+ ref=IDirectSound3DListener_Release(listener);
+ ok(ref==0,"IDirectSound3dListener_Release() listener has %d "
+ "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 {
- ref=IDirectSoundBuffer_Release(primary);
- ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
- "should have 0\n",ref);
+ ok(primary==NULL,"IDirectSound_CreateSoundBuffer(primary) failed "
+ "but primary created anyway\n");
+ 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 */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
More information about the wine-patches
mailing list