Module: wine Branch: master Commit: 472ef2881a8f5910a1fd2aef501a7f300f605fb8 URL: https://gitlab.winehq.org/wine/wine/-/commit/472ef2881a8f5910a1fd2aef501a7f3...
Author: Alex Henrie alexhenrie24@gmail.com Date: Thu Nov 2 21:44:27 2023 -0600
mspatcha: Use CRT allocation functions.
---
dlls/mspatcha/lzxd_dec.c | 5 ++--- dlls/mspatcha/mspatcha_main.c | 14 +++++++------- dlls/mspatcha/pa19.c | 10 ++-------- 3 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/dlls/mspatcha/lzxd_dec.c b/dlls/mspatcha/lzxd_dec.c index fe04723b3a7..71c70bdf847 100644 --- a/dlls/mspatcha/lzxd_dec.c +++ b/dlls/mspatcha/lzxd_dec.c @@ -25,7 +25,6 @@ #include <assert.h>
#include "windef.h" -#include "wine/heap.h" #include "wine/debug.h"
#include "patchapi.h" @@ -683,7 +682,7 @@ DWORD decode_lzxd_stream(const BYTE *src, const size_t input_size, if (progress_fn != NULL && !progress_fn(progress_ctx, 0, (ULONG)output_size)) return ERROR_CANCELLED;
- dec = heap_alloc(sizeof(*dec)); + dec = malloc(sizeof(*dec)); if (dec == NULL) return ERROR_OUTOFMEMORY;
@@ -765,7 +764,7 @@ DWORD decode_lzxd_stream(const BYTE *src, const size_t input_size, reverse_e8_transform(dst + predef_size, output_size, e8_file_size);
free_dec: - heap_free(dec); + free(dec);
return err; } diff --git a/dlls/mspatcha/mspatcha_main.c b/dlls/mspatcha/mspatcha_main.c index 1f6653da161..d8582566e9b 100644 --- a/dlls/mspatcha/mspatcha_main.c +++ b/dlls/mspatcha/mspatcha_main.c @@ -48,7 +48,7 @@ static WCHAR *strdupAW(const char *src) if (src) { int len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0); - if ((dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + if ((dst = malloc(len * sizeof(WCHAR)))) MultiByteToWideChar(CP_ACP, 0, src, -1, dst, len); } return dst; @@ -65,12 +65,12 @@ BOOL WINAPI TestApplyPatchToFileA(LPCSTR patch_file, LPCSTR old_file, ULONG appl if (!(patch_fileW = strdupAW(patch_file))) return FALSE; if (old_file && !(old_fileW = strdupAW(old_file))) { - HeapFree(GetProcessHeap(), 0, patch_fileW); + free(patch_fileW); return FALSE; } ret = apply_patch_to_file(patch_fileW, old_fileW, NULL, apply_flags, NULL, NULL, TRUE); - HeapFree(GetProcessHeap(), 0, patch_fileW); - HeapFree(GetProcessHeap(), 0, old_fileW); + free(patch_fileW); + free(old_fileW); return ret; }
@@ -123,10 +123,10 @@ BOOL WINAPI ApplyPatchToFileExA(LPCSTR patch_file, LPCSTR old_file, LPCSTR new_f
ret = apply_patch_to_file(patch_fileW, old_fileW, new_fileW, apply_flags, progress_fn, progress_ctx, FALSE);
- HeapFree(GetProcessHeap(), 0, new_fileW); + free(new_fileW); free_wstrs: - HeapFree(GetProcessHeap(), 0, patch_fileW); - HeapFree(GetProcessHeap(), 0, old_fileW); + free(patch_fileW); + free(old_fileW); return ret; }
diff --git a/dlls/mspatcha/pa19.c b/dlls/mspatcha/pa19.c index dc6ef79e2b2..4b21b199ed8 100644 --- a/dlls/mspatcha/pa19.c +++ b/dlls/mspatcha/pa19.c @@ -37,7 +37,6 @@
#include "windef.h" #include "winternl.h" -#include "wine/heap.h" #include "wine/debug.h"
#include "patchapi.h" @@ -319,7 +318,7 @@ static int read_header(struct patch_file_header *ph, const BYTE *buf, size_t siz if (ph->err != ERROR_SUCCESS) return -1;
- ph->file_table = heap_calloc(ph->input_file_count, sizeof(struct input_file_info)); + ph->file_table = calloc(ph->input_file_count, sizeof(struct input_file_info)); if (ph->file_table == NULL) { ph->err = ERROR_OUTOFMEMORY; @@ -436,11 +435,6 @@ static int read_header(struct patch_file_header *ph, const BYTE *buf, size_t siz return (ph->err == ERROR_SUCCESS) ? 0 : -1; }
-static void free_header(struct patch_file_header *ph) -{ - heap_free(ph->file_table); -} - #define TICKS_PER_SEC 10000000 #define SEC_TO_UNIX_EPOCH ((369 * 365 + 89) * (ULONGLONG)86400)
@@ -787,7 +781,7 @@ free_decode_buf: VirtualFree(decode_buf, 0, MEM_RELEASE);
free_patch_header: - free_header(&ph); + free(ph.file_table);
return err; }