[PATCH 1/3] mfplat: Do not make a copy when returning GUID attributes (Valgrind).
Nikolay Sivov
nsivov at codeweavers.com
Tue Nov 26 04:35:29 CST 2019
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
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 48e64adeef..6336b1b347 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;
}
--
2.24.0
More information about the wine-devel
mailing list