Module: wine Branch: master Commit: dd3f3f381f9e761325c7c06236de1241c9605ed6 URL: https://gitlab.winehq.org/wine/wine/-/commit/dd3f3f381f9e761325c7c06236de124...
Author: Paul Gofman pgofman@codeweavers.com Date: Tue Mar 28 09:34:12 2023 -0600
taskkill: Use CRT allocation functions.
---
programs/taskkill/taskkill.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/programs/taskkill/taskkill.c b/programs/taskkill/taskkill.c index 424e87b9a44..44ed4c79119 100644 --- a/programs/taskkill/taskkill.c +++ b/programs/taskkill/taskkill.c @@ -58,13 +58,13 @@ static int taskkill_vprintfW(const WCHAR *msg, va_list va_args) */ len = WideCharToMultiByte(GetOEMCP(), 0, msg_buffer, wlen, NULL, 0, NULL, NULL); - msgA = HeapAlloc(GetProcessHeap(), 0, len); + msgA = malloc(len); if (!msgA) return 0;
WideCharToMultiByte(GetOEMCP(), 0, msg_buffer, wlen, msgA, len, NULL, NULL); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), msgA, len, &count, FALSE); - HeapFree(GetProcessHeap(), 0, msgA); + free(msgA); }
return count; @@ -127,7 +127,7 @@ static DWORD *enumerate_processes(DWORD *list_count) { DWORD *pid_list, alloc_bytes = 1024 * sizeof(*pid_list), needed_bytes;
- pid_list = HeapAlloc(GetProcessHeap(), 0, alloc_bytes); + pid_list = malloc(alloc_bytes); if (!pid_list) return NULL;
@@ -137,7 +137,7 @@ static DWORD *enumerate_processes(DWORD *list_count)
if (!EnumProcesses(pid_list, alloc_bytes, &needed_bytes)) { - HeapFree(GetProcessHeap(), 0, pid_list); + free(pid_list); return NULL; }
@@ -150,10 +150,10 @@ static DWORD *enumerate_processes(DWORD *list_count) break;
alloc_bytes *= 2; - realloc_list = HeapReAlloc(GetProcessHeap(), 0, pid_list, alloc_bytes); + realloc_list = realloc(pid_list, alloc_bytes); if (!realloc_list) { - HeapFree(GetProcessHeap(), 0, pid_list); + free(pid_list); return NULL; } pid_list = realloc_list; @@ -288,7 +288,7 @@ static int send_close_messages(void) } }
- HeapFree(GetProcessHeap(), 0, pid_list); + free(pid_list); return status_code; }
@@ -403,7 +403,7 @@ static int terminate_processes(void) } }
- HeapFree(GetProcessHeap(), 0, pid_list); + free(pid_list); return status_code; }
@@ -413,8 +413,7 @@ static BOOL add_to_task_list(WCHAR *name)
if (!task_list) { - task_list = HeapAlloc(GetProcessHeap(), 0, - list_size * sizeof(*task_list)); + task_list = malloc(list_size * sizeof(*task_list)); if (!task_list) return FALSE; } @@ -423,8 +422,7 @@ static BOOL add_to_task_list(WCHAR *name) void *realloc_list;
list_size *= 2; - realloc_list = HeapReAlloc(GetProcessHeap(), 0, task_list, - list_size * sizeof(*task_list)); + realloc_list = realloc(task_list, list_size * sizeof(*task_list)); if (!realloc_list) return FALSE;
@@ -521,7 +519,7 @@ int __cdecl wmain(int argc, WCHAR *argv[])
if (!process_arguments(argc, argv)) { - HeapFree(GetProcessHeap(), 0, task_list); + free(task_list); return 1; }
@@ -530,6 +528,6 @@ int __cdecl wmain(int argc, WCHAR *argv[]) else status_code = send_close_messages();
- HeapFree(GetProcessHeap(), 0, task_list); + free(task_list); return status_code; }