Commit bba9e5ae authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

msvcrt: Use msvcrt heap for allocating envionment data.

parent 740e5ac7
...@@ -81,10 +81,7 @@ char ** msvcrt_SnapshotOfEnvironmentA(char **blk) ...@@ -81,10 +81,7 @@ char ** msvcrt_SnapshotOfEnvironmentA(char **blk)
if (*ptr != '=') count++; if (*ptr != '=') count++;
len += strlen(ptr) + 1; len += strlen(ptr) + 1;
} }
if (blk) blk = realloc(blk, count * sizeof(char*) + len);
blk = HeapReAlloc( GetProcessHeap(), 0, blk, count* sizeof(char*) + len );
else
blk = HeapAlloc(GetProcessHeap(), 0, count* sizeof(char*) + len );
if (blk) if (blk)
{ {
...@@ -115,10 +112,8 @@ wchar_t ** msvcrt_SnapshotOfEnvironmentW(wchar_t **wblk) ...@@ -115,10 +112,8 @@ wchar_t ** msvcrt_SnapshotOfEnvironmentW(wchar_t **wblk)
if (*wptr != '=') count++; if (*wptr != '=') count++;
len += wcslen(wptr) + 1; len += wcslen(wptr) + 1;
} }
if (wblk) wblk = realloc(wblk, count * sizeof(wchar_t*) + len * sizeof(wchar_t));
wblk = HeapReAlloc( GetProcessHeap(), 0, wblk, count* sizeof(wchar_t*) + len * sizeof(wchar_t));
else
wblk = HeapAlloc(GetProcessHeap(), 0, count* sizeof(wchar_t*) + len * sizeof(wchar_t));
if (wblk) if (wblk)
{ {
if (count) if (count)
...@@ -466,10 +461,6 @@ void msvcrt_free_args(void) ...@@ -466,10 +461,6 @@ void msvcrt_free_args(void)
{ {
/* FIXME: more things to free */ /* FIXME: more things to free */
HeapFree(GetProcessHeap(), 0, MSVCRT___argv); HeapFree(GetProcessHeap(), 0, MSVCRT___argv);
HeapFree(GetProcessHeap(), 0, MSVCRT___initenv);
HeapFree(GetProcessHeap(), 0, MSVCRT___winitenv);
HeapFree(GetProcessHeap(), 0, MSVCRT__environ);
HeapFree(GetProcessHeap(), 0, MSVCRT__wenviron);
HeapFree(GetProcessHeap(), 0, MSVCRT__pgmptr); HeapFree(GetProcessHeap(), 0, MSVCRT__pgmptr);
HeapFree(GetProcessHeap(), 0, MSVCRT__wpgmptr); HeapFree(GetProcessHeap(), 0, MSVCRT__wpgmptr);
HeapFree(GetProcessHeap(), 0, wargv_expand); HeapFree(GetProcessHeap(), 0, wargv_expand);
......
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