Robert Reif : dsound: Fix 2 bugs in ds3d tests.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 10 06:28:55 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 1f882cd68db5827fd6677bcd5cd66923680ac6a1
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=1f882cd68db5827fd6677bcd5cd66923680ac6a1

Author: Robert Reif <reif at earthlink.net>
Date:   Sat Apr  8 23:48:05 2006 -0400

dsound: Fix 2 bugs in ds3d tests.

Fix 2 bugs in the error paths of the ds3d.c test (coverity).

---

 dlls/dsound/tests/ds3d.c |   41 ++++++++++++++++++++++++++++++-----------
 1 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c
index 3d0c434..0825d68 100644
--- a/dlls/dsound/tests/ds3d.c
+++ b/dlls/dsound/tests/ds3d.c
@@ -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-cvs mailing list