[PATCH] windowscodecs/tests: Allocate strings so PropVariantClear can be called (Valgrind).

Sven Baars sven.wine at gmail.com
Mon Aug 19 12:04:40 CDT 2019


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43387
Signed-off-by: Sven Baars <sven.wine at gmail.com>
---
This patch supersedes 168755

 dlls/windowscodecs/tests/metadata.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c
index b434648fe5..e8c16fc4a9 100644
--- a/dlls/windowscodecs/tests/metadata.c
+++ b/dlls/windowscodecs/tests/metadata.c
@@ -2637,7 +2637,8 @@ static HRESULT WINAPI mdr_GetValue(IWICMetadataReader *iface, const PROPVARIANT
                 if (!lstrcmpA(U(*id).pszVal, current_metadata_block->item[i].id_str))
                 {
                     value->vt = VT_LPSTR;
-                    U(*value).pszVal = the_best;
+                    U(*value).pszVal = CoTaskMemAlloc(strlen(the_best)+1);
+                    strcpy(U(*value).pszVal, the_best);
                     return S_OK;
                 }
                 break;
@@ -2652,7 +2653,8 @@ static HRESULT WINAPI mdr_GetValue(IWICMetadataReader *iface, const PROPVARIANT
                 if (!lstrcmpA(idA, current_metadata_block->item[i].id_str))
                 {
                     value->vt = VT_LPSTR;
-                    U(*value).pszVal = the_worst;
+                    U(*value).pszVal = CoTaskMemAlloc(strlen(the_worst)+1);
+                    strcpy(U(*value).pszVal, the_worst);
                     return S_OK;
                 }
                 break;
@@ -3037,10 +3039,7 @@ static void test_queryreader(void)
                     ok(U(value).uiVal == test_data[i].value, "%u: expected %u, got %u\n",
                        i, test_data[i].value, U(value).uiVal);
             }
-
-            /*
-             * Do NOT call PropVariantClear(&value) for fake value types.
-             */
+            PropVariantClear(&value);
         }
     }
 
-- 
2.17.1




More information about the wine-devel mailing list