From bfaacf80da120b904c8be184df9d9dc8a4401cc2 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Fri, 29 Aug 2014 10:49:41 -0500 Subject: [PATCH] dwrite: Initialize realloc'ed memory to zero. --- dlls/dwrite/dwrite_private.h | 5 +++++ dlls/dwrite/main.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 0f386ce6219..8fda71e4a5b 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -34,6 +34,11 @@ static inline void *heap_realloc(void *mem, size_t len) return HeapReAlloc(GetProcessHeap(), 0, mem, len); } +static inline void *heap_realloc_zero(void *mem, size_t len) +{ + return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len); +} + static inline BOOL heap_free(void *mem) { return HeapFree(GetProcessHeap(), 0, mem); diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 59d9d64ae3e..83f705bb735 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -468,7 +468,7 @@ static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory int new_count = 0; new_count = This->loader_count * 2; - new_list = heap_realloc(This->loaders, new_count * sizeof(*This->loaders)); + new_list = heap_realloc_zero(This->loaders, new_count * sizeof(*This->loaders)); if (!new_list) return E_OUTOFMEMORY; @@ -603,7 +603,7 @@ static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory *iface int new_count = 0; new_count = This->file_loader_count * 2; - new_list = heap_realloc(This->file_loaders, new_count * sizeof(*This->file_loaders)); + new_list = heap_realloc_zero(This->file_loaders, new_count * sizeof(*This->file_loaders)); if (!new_list) return E_OUTOFMEMORY;