From c091f9b7f6cbc776f0448c0879bf9dbe472de720 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 26 Nov 2019 13:35:29 +0300 Subject: [PATCH] mfplat: Do not make a copy when returning GUID attributes (Valgrind). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfplat/main.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 48e64adeef0..6336b1b347a 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -1349,14 +1349,23 @@ HRESULT attributes_GetDouble(struct attributes *attributes, REFGUID key, double HRESULT attributes_GetGUID(struct attributes *attributes, REFGUID key, GUID *value) { - PROPVARIANT attrval; - HRESULT hr; + struct attribute *attribute; + HRESULT hr = S_OK; - PropVariantInit(&attrval); - attrval.vt = VT_CLSID; - hr = attributes_get_item(attributes, key, &attrval); - if (SUCCEEDED(hr)) - *value = *attrval.u.puuid; + EnterCriticalSection(&attributes->cs); + + attribute = attributes_find_item(attributes, key, NULL); + if (attribute) + { + if (attribute->value.vt == MF_ATTRIBUTE_GUID) + *value = *attribute->value.u.puuid; + else + hr = MF_E_INVALIDTYPE; + } + else + hr = MF_E_ATTRIBUTENOTFOUND; + + LeaveCriticalSection(&attributes->cs); return hr; }