[Gdiplus 01/16] Valgrind: fix warnings about using uninitialized memory, and leaking memory

Adam Petaccia adam at tpetaccia.com
Wed Jul 2 12:24:18 CDT 2008


---
 dlls/gdiplus/font.c       |    3 +++
 dlls/gdiplus/tests/font.c |    4 ++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 98a4c43..4196a55 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -370,6 +370,9 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
 
     hdc = GetDC(0);
     lstrcpynW(lfw.lfFaceName, name, sizeof(WCHAR) * LF_FACESIZE);
+    lfw.lfCharSet = DEFAULT_CHARSET;
+    lfw.lfEscapement = lfw.lfOrientation = 0;
+
     hFont = CreateFontIndirectW (&lfw);
     hfont_old = SelectObject(hdc, hFont);
 
diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 93efbc4..1e18c67 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -76,6 +76,8 @@ static void test_createfont(void)
         expect (i, unit);
         GdipDeleteFont(font);
     }
+
+    GdipDeleteFontFamily(fontfamily);
 }
 
 static void test_logfont(void)
@@ -152,6 +154,8 @@ static void test_fontfamily (void)
     WCHAR itsName[LF_FACESIZE];
     GpStatus stat;
 
+    ZeroMemory(itsName, sizeof(itsName));
+
     /* FontFamily can not be NULL */
     stat = GdipCreateFontFamilyFromName (arial , NULL, family);
     expect (InvalidParameter, stat);
-- 
1.5.4.3




More information about the wine-patches mailing list