Commit 952cd1d3 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

userenv/tests: Fix some memory leaks.

Found by Valgrind.
parent 7d3f37fc
...@@ -145,6 +145,7 @@ static void test_create_env(void) ...@@ -145,6 +145,7 @@ static void test_create_env(void)
todo_wine expect_env(TRUE, r, common_vars[i].name); todo_wine expect_env(TRUE, r, common_vars[i].name);
else else
expect_env(TRUE, r, common_vars[i].name); expect_env(TRUE, r, common_vars[i].name);
if (r) HeapFree(GetProcessHeap(), 0, st);
} }
} }
...@@ -164,6 +165,7 @@ static void test_create_env(void) ...@@ -164,6 +165,7 @@ static void test_create_env(void)
todo_wine expect_env(TRUE, r, common_post_nt4_vars[i].name); todo_wine expect_env(TRUE, r, common_post_nt4_vars[i].name);
else else
expect_env(TRUE, r, common_post_nt4_vars[i].name); expect_env(TRUE, r, common_post_nt4_vars[i].name);
if (r) HeapFree(GetProcessHeap(), 0, st);
} }
} }
} }
...@@ -178,17 +180,23 @@ static void test_create_env(void) ...@@ -178,17 +180,23 @@ static void test_create_env(void)
todo_wine expect_env(TRUE, r, htok_vars[i].name); todo_wine expect_env(TRUE, r, htok_vars[i].name);
else else
expect_env(TRUE, r, htok_vars[i].name); expect_env(TRUE, r, htok_vars[i].name);
if (r) HeapFree(GetProcessHeap(), 0, st);
} }
} }
r = get_env(env[0], "WINE_XYZZY", &st); r = get_env(env[0], "WINE_XYZZY", &st);
expect(FALSE, r); expect(FALSE, r);
r = get_env(env[1], "WINE_XYZZY", &st); r = get_env(env[1], "WINE_XYZZY", &st);
expect(FALSE, r); expect(FALSE, r);
r = get_env(env[2], "WINE_XYZZY", &st); r = get_env(env[2], "WINE_XYZZY", &st);
expect(TRUE, r); expect(TRUE, r);
if (r) HeapFree(GetProcessHeap(), 0, st);
r = get_env(env[3], "WINE_XYZZY", &st); r = get_env(env[3], "WINE_XYZZY", &st);
expect(TRUE, r); expect(TRUE, r);
if (r) HeapFree(GetProcessHeap(), 0, st);
} }
START_TEST(userenv) START_TEST(userenv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment