Sven Baars : mmdevapi/tests: Use PropVariantClear after calling IPropertyStore_GetValue (Valgrind).

Alexandre Julliard julliard at winehq.org
Mon Jun 3 16:07:14 CDT 2019


Module: wine
Branch: master
Commit: acea82ac74ebe92cf9aaf0f2184f17daa5030484
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=acea82ac74ebe92cf9aaf0f2184f17daa5030484

Author: Sven Baars <sven.wine at gmail.com>
Date:   Sun Jun  2 12:01:23 2019 +0200

mmdevapi/tests: Use PropVariantClear after calling IPropertyStore_GetValue (Valgrind).

Signed-off-by: Sven Baars <sven.wine at gmail.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mmdevapi/tests/propstore.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/mmdevapi/tests/propstore.c b/dlls/mmdevapi/tests/propstore.c
index 02340ba..bbd4ffe 100644
--- a/dlls/mmdevapi/tests/propstore.c
+++ b/dlls/mmdevapi/tests/propstore.c
@@ -58,23 +58,26 @@ static void test_propertystore(IPropertyStore *store)
     {
         WideCharToMultiByte(CP_ACP, 0, pv.u.pwszVal, -1, temp, sizeof(temp)-1, NULL, NULL);
         trace("guid: %s\n", temp);
-        CoTaskMemFree(pv.u.pwszVal);
+        PropVariantClear(&pv);
     }
 
     pv.vt = VT_EMPTY;
     hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_FriendlyName, &pv);
     ok(hr == S_OK, "Failed with %08x\n", hr);
     ok(pv.vt == VT_LPWSTR && pv.u.pwszVal, "FriendlyName value had wrong type: 0x%x or was NULL\n", pv.vt);
+    PropVariantClear(&pv);
 
     pv.vt = VT_EMPTY;
     hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_Enabled, &pv);
     ok(hr == S_OK, "Failed with %08x\n", hr);
     ok(pv.vt == VT_EMPTY, "Key should not be found\n");
+    PropVariantClear(&pv);
 
     pv.vt = VT_EMPTY;
     hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_ClassGuid, &pv);
     ok(hr == S_OK, "Failed with %08x\n", hr);
     ok(pv.vt == VT_EMPTY, "Key should not be found\n");
+    PropVariantClear(&pv);
 }
 
 static void test_deviceinterface(IPropertyStore *store)
@@ -91,7 +94,7 @@ static void test_deviceinterface(IPropertyStore *store)
     ok(hr == S_OK, "GetValue failed: %08x\n", hr);
     ok(pv.vt == VT_LPWSTR, "Got wrong variant type: 0x%x\n", pv.vt);
     trace("device interface: %s\n", wine_dbgstr_w(pv.u.pwszVal));
-    CoTaskMemFree(pv.u.pwszVal);
+    PropVariantClear(&pv);
 }
 
 static void test_getat(IPropertyStore *store)




More information about the wine-cvs mailing list