ntdll: fix uninitialized buffers, found via valgrind

Zac Brown zac at zacbrown.org
Wed Nov 21 18:08:50 CST 2007


Hi,

Fixes valgrind error: 
	http://kegel.com/wine/valgrind/20071121/vg-ntdll_env.txt

Changelog: 
* Initialize buffers used in test using memset

--
Zac Brown <zac AT zacbrown DOT org>


 dlls/ntdll/tests/env.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/tests/env.c b/dlls/ntdll/tests/env.c
index d822946..90a3bf1 100644
--- a/dlls/ntdll/tests/env.c
+++ b/dlls/ntdll/tests/env.c
@@ -80,8 +80,7 @@ static void testQuery(void)
         {NULL, 0, 0, NULL}
     };
 
-    WCHAR               bn[257];
-    WCHAR               bv[257];
+    
     UNICODE_STRING      name;
     UNICODE_STRING      value;
     const struct test*  test;
@@ -89,6 +88,10 @@ static void testQuery(void)
 
     for (test = tests; test->var; test++)
     {
+        WCHAR bn[257];
+        WCHAR bv[257];
+        memset(bn, '\0', 257 * sizeof(WCHAR));
+        memset(bv, '\0', 257 * sizeof(WCHAR));
         name.Length = strlen(test->var) * 2;
         name.MaximumLength = name.Length + 2;
         name.Buffer = bn;
-- 
1.5.2.5




More information about the wine-patches mailing list