windowscodecs: Fix a memory leak.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2017-06-29 12:03:59 +08:00 committed by Alexandre Julliard
parent 97546cfbb7
commit 2eeef78e8d
1 changed files with 7 additions and 3 deletions

View File

@ -212,7 +212,7 @@ static HRESULT get_token(struct string_t *elem, PROPVARIANT *id, PROPVARIANT *sc
hr = get_token(&next_elem, id, schema, idx); hr = get_token(&next_elem, id, schema, idx);
if (hr != S_OK) if (hr != S_OK)
{ {
TRACE("parse_elem error %#x\n", hr); TRACE("get_token error %#x\n", hr);
return hr; return hr;
} }
elem->len = (end - start) + next_elem.len; 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++; if (*end == '\\') end++;
*bstr++ = *end++; *bstr++ = *end++;
} }
if (!*end || *end != '}') if (*end != '}')
{ {
PropVariantClear(&next_token); PropVariantClear(&next_token);
return WINCODEC_ERR_INVALIDQUERYREQUEST; 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->vt = VT_CLSID;
id->u.puuid = CoTaskMemAlloc(sizeof(GUID)); 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); hr = UuidFromStringW(next_token.u.bstrVal, id->u.puuid);
} }