mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
kernel32/tests: Free environment strings buffer at the conclusion of the environment tests.
This commit is contained in:
parent
6c8f8a64b0
commit
70d67becac
1 changed files with 17 additions and 14 deletions
|
@ -1102,10 +1102,11 @@ static void test_Environment(void)
|
|||
char buffer[MAX_PATH];
|
||||
PROCESS_INFORMATION info;
|
||||
STARTUPINFOA startup;
|
||||
char* child_env;
|
||||
char *child_env;
|
||||
int child_env_len;
|
||||
char* ptr;
|
||||
char* env;
|
||||
char *ptr;
|
||||
char *ptr2;
|
||||
char *env;
|
||||
int slen;
|
||||
|
||||
memset(&startup, 0, sizeof(startup));
|
||||
|
@ -1121,8 +1122,9 @@ static void test_Environment(void)
|
|||
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
||||
/* child process has changed result file, so let profile functions know about it */
|
||||
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
|
||||
|
||||
cmpEnvironment(GetEnvironmentStringsA());
|
||||
|
||||
env = GetEnvironmentStringsA();
|
||||
cmpEnvironment(env);
|
||||
release_memory();
|
||||
assert(DeleteFileA(resfile) != 0);
|
||||
|
||||
|
@ -1134,9 +1136,9 @@ static void test_Environment(void)
|
|||
/* the basics */
|
||||
get_file_name(resfile);
|
||||
sprintf(buffer, "\"%s\" tests/process.c \"%s\"", selfname, resfile);
|
||||
|
||||
|
||||
child_env_len = 0;
|
||||
ptr = GetEnvironmentStringsA();
|
||||
ptr = env;
|
||||
while(*ptr)
|
||||
{
|
||||
slen = strlen(ptr)+1;
|
||||
|
@ -1146,7 +1148,7 @@ static void test_Environment(void)
|
|||
/* Add space for additional environment variables */
|
||||
child_env_len += 256;
|
||||
child_env = HeapAlloc(GetProcessHeap(), 0, child_env_len);
|
||||
|
||||
|
||||
ptr = child_env;
|
||||
sprintf(ptr, "=%c:=%s", 'C', "C:\\FOO\\BAR");
|
||||
ptr += strlen(ptr) + 1;
|
||||
|
@ -1161,13 +1163,13 @@ static void test_Environment(void)
|
|||
* - PATH (already set above)
|
||||
* - the directory definitions (=[A-Z]:=)
|
||||
*/
|
||||
for (env = GetEnvironmentStringsA(); *env; env += strlen(env) + 1)
|
||||
for (ptr2 = env; *ptr2; ptr2 += strlen(ptr2) + 1)
|
||||
{
|
||||
if (strncmp(env, "PATH=", 5) != 0 &&
|
||||
strncmp(env, "WINELOADER=", 11) != 0 &&
|
||||
!is_str_env_drive_dir(env))
|
||||
if (strncmp(ptr2, "PATH=", 5) != 0 &&
|
||||
strncmp(ptr2, "WINELOADER=", 11) != 0 &&
|
||||
!is_str_env_drive_dir(ptr2))
|
||||
{
|
||||
strcpy(ptr, env);
|
||||
strcpy(ptr, ptr2);
|
||||
ptr += strlen(ptr) + 1;
|
||||
}
|
||||
}
|
||||
|
@ -1177,10 +1179,11 @@ static void test_Environment(void)
|
|||
ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
||||
/* child process has changed result file, so let profile functions know about it */
|
||||
WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
|
||||
|
||||
|
||||
cmpEnvironment(child_env);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, child_env);
|
||||
FreeEnvironmentStringsA(env);
|
||||
release_memory();
|
||||
assert(DeleteFileA(resfile) != 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue