Commit 0c01b71a authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

cmd: Replace malloc() with HeapAlloc().

parent c48e5e04
...@@ -1033,7 +1033,7 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable, ...@@ -1033,7 +1033,7 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
if (conditionTRUE && firstcmd && *firstcmd) { if (conditionTRUE && firstcmd && *firstcmd) {
WCHAR *command = WCMD_strdupW(firstcmd); WCHAR *command = WCMD_strdupW(firstcmd);
WCMD_execute (firstcmd, (*cmdList)->redirects, variable, value, cmdList); WCMD_execute (firstcmd, (*cmdList)->redirects, variable, value, cmdList);
free (command); HeapFree(GetProcessHeap(), 0, command);
} }
......
...@@ -416,8 +416,7 @@ static void WCMD_show_prompt (void) { ...@@ -416,8 +416,7 @@ static void WCMD_show_prompt (void) {
*/ */
WCHAR *WCMD_strdupW(WCHAR *input) { WCHAR *WCMD_strdupW(WCHAR *input) {
int len=strlenW(input)+1; int len=strlenW(input)+1;
/* Note: Use malloc not HeapAlloc to emulate strdup */ WCHAR *result = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
WCHAR *result = malloc(len * sizeof(WCHAR));
memcpy(result, input, len * sizeof(WCHAR)); memcpy(result, input, len * sizeof(WCHAR));
return result; return result;
} }
...@@ -749,9 +748,9 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR *forVar, WCHAR *forVal) { ...@@ -749,9 +748,9 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR *forVar, WCHAR *forVal) {
thisVarContents + (lastFound-searchIn)); thisVarContents + (lastFound-searchIn));
strcatW(outputposn, s); strcatW(outputposn, s);
} }
free(s); HeapFree(GetProcessHeap(), 0, s);
free(searchIn); HeapFree(GetProcessHeap(), 0, searchIn);
free(searchFor); HeapFree(GetProcessHeap(), 0, searchFor);
return start; return start;
} }
return start+1; return start+1;
......
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