Maarten Lankhorst : mmdevapi: Fix reference leak in tests.
Alexandre Julliard
julliard at winehq.org
Wed Jan 6 13:00:56 CST 2010
Module: wine
Branch: master
Commit: 7615ec070055951a4bda237e54d59c8b28b0d627
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7615ec070055951a4bda237e54d59c8b28b0d627
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Tue Jan 5 22:35:18 2010 +0100
mmdevapi: Fix reference leak in tests.
Reported by Dan Kegel
---
dlls/mmdevapi/tests/mmdevenum.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/dlls/mmdevapi/tests/mmdevenum.c b/dlls/mmdevapi/tests/mmdevenum.c
index 9e8e55c..35e0152 100644
--- a/dlls/mmdevapi/tests/mmdevenum.c
+++ b/dlls/mmdevapi/tests/mmdevenum.c
@@ -82,14 +82,18 @@ static void test_collection(IMMDeviceEnumerator *mme, IMMDeviceCollection *col)
ok(hr == E_INVALIDARG, "Asking for too high device returned 0x%08x\n", hr);
ok(dev == NULL, "Returned non-null device\n");
- if (!numdev) return;
- hr = IMMDeviceCollection_Item(col, 0, NULL);
- ok(hr == E_POINTER, "Query with null pointer returned 0x%08x\n", hr);
-
- hr = IMMDeviceCollection_Item(col, 0, &dev);
- ok(hr == S_OK, "Valid Item returned 0x%08x\n", hr);
- ok(dev != NULL, "Device is null!\n");
- if (dev) IUnknown_Release(dev);
+ if (numdev)
+ {
+ hr = IMMDeviceCollection_Item(col, 0, NULL);
+ ok(hr == E_POINTER, "Query with null pointer returned 0x%08x\n", hr);
+
+ hr = IMMDeviceCollection_Item(col, 0, &dev);
+ ok(hr == S_OK, "Valid Item returned 0x%08x\n", hr);
+ ok(dev != NULL, "Device is null!\n");
+ if (dev)
+ IUnknown_Release(dev);
+ }
+ IUnknown_Release(col);
}
/* Only do parameter tests here, the actual MMDevice testing should be a separate test */
More information about the wine-cvs
mailing list