Aric Stewart : dwrite: Initialize realloc'ed memory to zero.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 29 15:09:58 CDT 2014


Module: wine
Branch: master
Commit: bfaacf80da120b904c8be184df9d9dc8a4401cc2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bfaacf80da120b904c8be184df9d9dc8a4401cc2

Author: Aric Stewart <aric at codeweavers.com>
Date:   Fri Aug 29 10:49:41 2014 -0500

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 0f386ce..8fda71e 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 59d9d64..83f705b 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;




More information about the wine-cvs mailing list