[PATCH 6/7] usp10: Use heap_calloc() in _ItemizeInternal().
Aric Stewart
aric at codeweavers.com
Tue Mar 13 06:42:36 CDT 2018
Signed-off-by: Aric Stewart <aric at codeweavers.com>
On 3/12/18 4:06 AM, Henri Verbeet wrote:
> Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
> ---
> dlls/usp10/usp10.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
> index 54428301dc3..032d0745b04 100644
> --- a/dlls/usp10/usp10.c
> +++ b/dlls/usp10/usp10.c
> @@ -1373,7 +1373,7 @@ static HRESULT _ItemizeInternal(const WCHAR *pwcInChars, int cInChars,
> if (!pwcInChars || !cInChars || !pItems || cMaxItems < 2)
> return E_INVALIDARG;
>
> - if (!(scripts = heap_alloc(cInChars * sizeof(*scripts))))
> + if (!(scripts = heap_calloc(cInChars, sizeof(*scripts))))
> return E_OUTOFMEMORY;
>
> for (i = 0; i < cInChars; i++)
> @@ -1464,16 +1464,13 @@ static HRESULT _ItemizeInternal(const WCHAR *pwcInChars, int cInChars,
>
> if (psState && psControl)
> {
> - levels = heap_alloc_zero(cInChars * sizeof(WORD));
> - if (!levels)
> + if (!(levels = heap_calloc(cInChars, sizeof(*levels))))
> goto nomemory;
>
> - overrides = heap_alloc_zero(cInChars * sizeof(WORD));
> - if (!overrides)
> + if (!(overrides = heap_calloc(cInChars, sizeof(*overrides))))
> goto nomemory;
>
> - layout_levels = heap_alloc_zero(cInChars * sizeof(WORD));
> - if (!layout_levels)
> + if (!(layout_levels = heap_calloc(cInChars, sizeof(*layout_levels))))
> goto nomemory;
>
> if (psState->fOverrideDirection)
> @@ -1519,8 +1516,7 @@ static HRESULT _ItemizeInternal(const WCHAR *pwcInChars, int cInChars,
> static const WCHAR math_punc[] = {'#','$','%','+',',','-','.','/',':',0x2212, 0x2044, 0x00a0,0};
> static const WCHAR repeatable_math_punc[] = {'#','$','%','+','-','/',0x2212, 0x2044,0};
>
> - strength = heap_alloc_zero(cInChars * sizeof(WORD));
> - if (!strength)
> + if (!(strength = heap_calloc(cInChars, sizeof(*strength))))
> goto nomemory;
> BIDI_GetStrengths(pwcInChars, cInChars, psControl, strength);
>
>
More information about the wine-devel
mailing list