[PATCH 5/8] dwrite: Call RegEnumValueW with value and val_count parameters.
Jonas Maebe
jonas.maebe at elis.ugent.be
Tue Jun 30 08:35:13 CDT 2015
Bernhard Übelacker wrote on Tue, 30 Jun 2015:
> Bug #38796
> ---
> dlls/dwrite/font.c | 28 +++++++++++++++++++++++-----
> 1 file changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
> index 2091867..3e25992 100644
> --- a/dlls/dwrite/font.c
> +++ b/dlls/dwrite/font.c
> @@ -1845,8 +1845,8 @@ static ULONG WINAPI
> systemfontfileenumerator_Release(IDWriteFontFileEnumerator *
> static HRESULT WINAPI
> systemfontfileenumerator_GetCurrentFontFile(IDWriteFontFileEnumerator
> *iface, IDWriteFontFile **file)
> {
> struct system_fontfile_enumerator *enumerator =
> impl_from_IDWriteFontFileEnumerator(iface);
> - DWORD ret, type, count;
> - WCHAR *filename;
> + DWORD ret, type, val_count, count;
> + WCHAR *value, *filename;
> HRESULT hr;
>
> *file = NULL;
> @@ -1854,14 +1854,20 @@ static HRESULT WINAPI
> systemfontfileenumerator_GetCurrentFontFile(IDWriteFontFil
> if (enumerator->index < 0)
> return E_FAIL;
>
> - if (RegEnumValueW(enumerator->hkey, enumerator->index, NULL,
> NULL, NULL, &type, NULL, &count))
> + ret = RegQueryInfoKeyW(enumerator->hkey, NULL, NULL, NULL,
> NULL, NULL, NULL, NULL, &val_count, &count, NULL, NULL);
> + if (ret != ERROR_SUCCESS)
> return E_FAIL;
>
> + val_count++;
> + if (!(value = heap_alloc( val_count * sizeof(value[0]) )))
> + return E_OUTOFMEMORY;
> +
> if (!(filename = heap_alloc(count)))
> return E_OUTOFMEMORY;
This leaks value if the filename allocation fails.
Jonas
More information about the wine-patches
mailing list