Commit 472ef288 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

mspatcha: Use CRT allocation functions.

parent a76bf99e
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <assert.h> #include <assert.h>
#include "windef.h" #include "windef.h"
#include "wine/heap.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "patchapi.h" #include "patchapi.h"
...@@ -683,7 +682,7 @@ DWORD decode_lzxd_stream(const BYTE *src, const size_t input_size, ...@@ -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)) if (progress_fn != NULL && !progress_fn(progress_ctx, 0, (ULONG)output_size))
return ERROR_CANCELLED; return ERROR_CANCELLED;
dec = heap_alloc(sizeof(*dec)); dec = malloc(sizeof(*dec));
if (dec == NULL) if (dec == NULL)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
...@@ -765,7 +764,7 @@ DWORD decode_lzxd_stream(const BYTE *src, const size_t input_size, ...@@ -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); reverse_e8_transform(dst + predef_size, output_size, e8_file_size);
free_dec: free_dec:
heap_free(dec); free(dec);
return err; return err;
} }
...@@ -48,7 +48,7 @@ static WCHAR *strdupAW(const char *src) ...@@ -48,7 +48,7 @@ static WCHAR *strdupAW(const char *src)
if (src) if (src)
{ {
int len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0); 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); MultiByteToWideChar(CP_ACP, 0, src, -1, dst, len);
} }
return dst; return dst;
...@@ -65,12 +65,12 @@ BOOL WINAPI TestApplyPatchToFileA(LPCSTR patch_file, LPCSTR old_file, ULONG appl ...@@ -65,12 +65,12 @@ BOOL WINAPI TestApplyPatchToFileA(LPCSTR patch_file, LPCSTR old_file, ULONG appl
if (!(patch_fileW = strdupAW(patch_file))) return FALSE; if (!(patch_fileW = strdupAW(patch_file))) return FALSE;
if (old_file && !(old_fileW = strdupAW(old_file))) if (old_file && !(old_fileW = strdupAW(old_file)))
{ {
HeapFree(GetProcessHeap(), 0, patch_fileW); free(patch_fileW);
return FALSE; return FALSE;
} }
ret = apply_patch_to_file(patch_fileW, old_fileW, NULL, apply_flags, NULL, NULL, TRUE); ret = apply_patch_to_file(patch_fileW, old_fileW, NULL, apply_flags, NULL, NULL, TRUE);
HeapFree(GetProcessHeap(), 0, patch_fileW); free(patch_fileW);
HeapFree(GetProcessHeap(), 0, old_fileW); free(old_fileW);
return ret; return ret;
} }
...@@ -123,10 +123,10 @@ BOOL WINAPI ApplyPatchToFileExA(LPCSTR patch_file, LPCSTR old_file, LPCSTR new_f ...@@ -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); 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: free_wstrs:
HeapFree(GetProcessHeap(), 0, patch_fileW); free(patch_fileW);
HeapFree(GetProcessHeap(), 0, old_fileW); free(old_fileW);
return ret; return ret;
} }
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "windef.h" #include "windef.h"
#include "winternl.h" #include "winternl.h"
#include "wine/heap.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "patchapi.h" #include "patchapi.h"
...@@ -319,7 +318,7 @@ static int read_header(struct patch_file_header *ph, const BYTE *buf, size_t siz ...@@ -319,7 +318,7 @@ static int read_header(struct patch_file_header *ph, const BYTE *buf, size_t siz
if (ph->err != ERROR_SUCCESS) if (ph->err != ERROR_SUCCESS)
return -1; 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) if (ph->file_table == NULL)
{ {
ph->err = ERROR_OUTOFMEMORY; ph->err = ERROR_OUTOFMEMORY;
...@@ -436,11 +435,6 @@ static int read_header(struct patch_file_header *ph, const BYTE *buf, size_t siz ...@@ -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; 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 TICKS_PER_SEC 10000000
#define SEC_TO_UNIX_EPOCH ((369 * 365 + 89) * (ULONGLONG)86400) #define SEC_TO_UNIX_EPOCH ((369 * 365 + 89) * (ULONGLONG)86400)
...@@ -787,7 +781,7 @@ free_decode_buf: ...@@ -787,7 +781,7 @@ free_decode_buf:
VirtualFree(decode_buf, 0, MEM_RELEASE); VirtualFree(decode_buf, 0, MEM_RELEASE);
free_patch_header: free_patch_header:
free_header(&ph); free(ph.file_table);
return err; return err;
} }
......
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