diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-04 12:55:25 +0100 |
---|---|---|
committer | Simon Rozman <simon@rozman.si> | 2020-11-04 13:21:43 +0100 |
commit | 5d1efa847fc038d8c34b0e050a30bb07c6cb686e (patch) | |
tree | 850e61a4a7ec676cb5a67b1dd6e75e884b56a4a6 /api/rundll32_i.c | |
parent | api: concatenate function name at runtime (diff) | |
download | wintun-5d1efa847fc038d8c34b0e050a30bb07c6cb686e.tar.xz wintun-5d1efa847fc038d8c34b0e050a30bb07c6cb686e.zip |
api: use a logging alloc function
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'api/rundll32_i.c')
-rw-r--r-- | api/rundll32_i.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/api/rundll32_i.c b/api/rundll32_i.c index 5f9de48..1b0a8d4 100644 --- a/api/rundll32_i.c +++ b/api/rundll32_i.c @@ -131,11 +131,10 @@ static _Return_type_success_(return != FALSE) BOOL ExecuteRunDll32( goto cleanupDelete; } size_t CommandLineLen = 10 + MAX_PATH + 2 + wcslen(Arguments) + 1; - WCHAR *CommandLine = HeapAlloc(ModuleHeap, 0, CommandLineLen * sizeof(WCHAR)); + WCHAR *CommandLine = Alloc(CommandLineLen * sizeof(WCHAR)); if (!CommandLine) { - LOG(WINTUN_LOG_ERR, L"Out of memory"); - LastError = ERROR_OUTOFMEMORY; + LastError = GetLastError(); goto cleanupDelete; } if (_snwprintf_s(CommandLine, CommandLineLen, _TRUNCATE, L"rundll32 \"%.*s\",%s", MAX_PATH, DllPath, Arguments) == @@ -218,7 +217,7 @@ cleanupPipes: CloseHandle(StreamWStderr); CloseHandle(StreamRStdout); CloseHandle(StreamWStdout); - HeapFree(ModuleHeap, 0, CommandLine); + Free(CommandLine); cleanupDelete: DeleteFileW(DllPath); cleanupDirectory: |