windowscodecs: Fix a memory leak.

Dmitry Timoshkov dmitry at baikal.ru
Wed Jun 28 23:03:59 CDT 2017


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/windowscodecs/metadataquery.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c
index 473836f8dc..e33884881b 100644
--- a/dlls/windowscodecs/metadataquery.c
+++ b/dlls/windowscodecs/metadataquery.c
@@ -212,7 +212,7 @@ static HRESULT get_token(struct string_t *elem, PROPVARIANT *id, PROPVARIANT *sc
         hr = get_token(&next_elem, id, schema, idx);
         if (hr != S_OK)
         {
-            TRACE("parse_elem error %#x\n", hr);
+            TRACE("get_token error %#x\n", hr);
             return hr;
         }
         elem->len = (end - start) + next_elem.len;
@@ -248,7 +248,7 @@ static HRESULT get_token(struct string_t *elem, PROPVARIANT *id, PROPVARIANT *sc
             if (*end == '\\') end++;
             *bstr++ = *end++;
         }
-        if (!*end || *end != '}')
+        if (*end != '}')
         {
             PropVariantClear(&next_token);
             return WINCODEC_ERR_INVALIDQUERYREQUEST;
@@ -260,7 +260,11 @@ static HRESULT get_token(struct string_t *elem, PROPVARIANT *id, PROPVARIANT *sc
         {
             id->vt = VT_CLSID;
             id->u.puuid = CoTaskMemAlloc(sizeof(GUID));
-            if (!id->u.puuid) return E_OUTOFMEMORY;
+            if (!id->u.puuid)
+            {
+                PropVariantClear(&next_token);
+                return E_OUTOFMEMORY;
+            }
 
             hr = UuidFromStringW(next_token.u.bstrVal, id->u.puuid);
         }
-- 
2.13.2




More information about the wine-patches mailing list