cmd: Replace malloc() with HeapAlloc().

oldstable
Francois Gouget 2009-06-15 10:59:45 +02:00 committed by Alexandre Julliard
parent c48e5e048f
commit 0c01b71a4e
2 changed files with 5 additions and 6 deletions

View File

@ -1033,7 +1033,7 @@ void WCMD_part_execute(CMD_LIST **cmdList, WCHAR *firstcmd, WCHAR *variable,
if (conditionTRUE && firstcmd && *firstcmd) {
WCHAR *command = WCMD_strdupW(firstcmd);
WCMD_execute (firstcmd, (*cmdList)->redirects, variable, value, cmdList);
free (command);
HeapFree(GetProcessHeap(), 0, command);
}

View File

@ -416,8 +416,7 @@ static void WCMD_show_prompt (void) {
*/
WCHAR *WCMD_strdupW(WCHAR *input) {
int len=strlenW(input)+1;
/* Note: Use malloc not HeapAlloc to emulate strdup */
WCHAR *result = malloc(len * sizeof(WCHAR));
WCHAR *result = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
memcpy(result, input, len * sizeof(WCHAR));
return result;
}
@ -749,9 +748,9 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR *forVar, WCHAR *forVal) {
thisVarContents + (lastFound-searchIn));
strcatW(outputposn, s);
}
free(s);
free(searchIn);
free(searchFor);
HeapFree(GetProcessHeap(), 0, s);
HeapFree(GetProcessHeap(), 0, searchIn);
HeapFree(GetProcessHeap(), 0, searchFor);
return start;
}
return start+1;