Module: wine Branch: master Commit: 48801b6dd7d5a5b5c7d8f4c371bc285a686b6d64 URL: https://gitlab.winehq.org/wine/wine/-/commit/48801b6dd7d5a5b5c7d8f4c371bc285...
Author: Alex Henrie alexhenrie24@gmail.com Date: Thu Nov 2 22:24:01 2023 -0600
wtsapi32: Use CRT allocation functions.
---
dlls/wtsapi32/wtsapi32.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/dlls/wtsapi32/wtsapi32.c b/dlls/wtsapi32/wtsapi32.c index f4072e7090b..785082d12a3 100644 --- a/dlls/wtsapi32/wtsapi32.c +++ b/dlls/wtsapi32/wtsapi32.c @@ -26,7 +26,6 @@ #include "lmcons.h" #include "wtsapi32.h" #include "wine/debug.h" -#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
@@ -149,7 +148,7 @@ BOOL WINAPI WTSEnumerateProcessesExW(HANDLE server, DWORD *level, DWORD session_ nt_process = (SYSTEM_PROCESS_INFORMATION *)((char *)nt_process + nt_process->NextEntryOffset); }
- if (!(info = heap_alloc(size))) + if (!(info = malloc(size))) { free(nt_info); SetLastError(ERROR_OUTOFMEMORY); @@ -315,7 +314,7 @@ BOOL WINAPI WTSEnumerateSessionsA(HANDLE server, DWORD reserved, DWORD version, size += sizeof(**session_info) + len; }
- if (!(*session_info = heap_alloc(size))) + if (!(*session_info = malloc(size))) { WTSFreeMemory(infoW); SetLastError(ERROR_OUTOFMEMORY); @@ -355,7 +354,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE server, DWORD reserved, DWORD version,
if (!session_info || !count) return FALSE;
- if (!(*session_info = heap_alloc(sizeof(**session_info) + sizeof(session_name)))) + if (!(*session_info = malloc(sizeof(**session_info) + sizeof(session_name)))) { SetLastError(ERROR_OUTOFMEMORY); return FALSE; @@ -378,7 +377,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE server, DWORD reserved, DWORD version, */ void WINAPI WTSFreeMemory(PVOID pMemory) { - heap_free(pMemory); + free(pMemory); }
/************************************************************ @@ -387,7 +386,7 @@ void WINAPI WTSFreeMemory(PVOID pMemory) BOOL WINAPI WTSFreeMemoryExA(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb) { TRACE("%d %p %ld\n", type, ptr, nmemb); - heap_free(ptr); + free(ptr); return TRUE; }
@@ -397,7 +396,7 @@ BOOL WINAPI WTSFreeMemoryExA(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb) BOOL WINAPI WTSFreeMemoryExW(WTS_TYPE_CLASS type, void *ptr, ULONG nmemb) { TRACE("%d %p %ld\n", type, ptr, nmemb); - heap_free(ptr); + free(ptr); return TRUE; }
@@ -481,7 +480,7 @@ BOOL WINAPI WTSQuerySessionInformationA(HANDLE server, DWORD session_id, WTS_INF return FALSE; }
- if (!(*buffer = heap_alloc(*count))) + if (!(*buffer = malloc(*count))) { WTSFreeMemory(bufferW); return FALSE; @@ -490,7 +489,7 @@ BOOL WINAPI WTSQuerySessionInformationA(HANDLE server, DWORD session_id, WTS_INF if (!(*count = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, *buffer, *count, NULL, NULL))) { WTSFreeMemory(bufferW); - heap_free(*buffer); + free(*buffer); return FALSE; }
@@ -515,7 +514,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF { WTS_CONNECTSTATE_CLASS *state;
- if (!(state = heap_alloc(sizeof(*state)))) return FALSE; + if (!(state = malloc(sizeof(*state)))) return FALSE; *state = WTSActive; *buffer = (WCHAR *)state; *count = sizeof(*state); @@ -526,7 +525,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF { USHORT *protocol;
- if (!(protocol = heap_alloc(sizeof(*protocol)))) return FALSE; + if (!(protocol = malloc(sizeof(*protocol)))) return FALSE; FIXME("returning 0 protocol type\n"); *protocol = 0; *buffer = (WCHAR *)protocol; @@ -539,7 +538,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF DWORD size = UNLEN + 1; WCHAR *username;
- if (!(username = heap_alloc(size * sizeof(WCHAR)))) return FALSE; + if (!(username = malloc(size * sizeof(WCHAR)))) return FALSE; GetUserNameW(username, &size); *buffer = username; *count = size * sizeof(WCHAR); @@ -551,7 +550,7 @@ BOOL WINAPI WTSQuerySessionInformationW(HANDLE server, DWORD session_id, WTS_INF DWORD size = MAX_COMPUTERNAME_LENGTH + 1; WCHAR *computername;
- if (!(computername = heap_alloc(size * sizeof(WCHAR)))) return FALSE; + if (!(computername = malloc(size * sizeof(WCHAR)))) return FALSE; GetComputerNameW(computername, &size); *buffer = computername; /* GetComputerNameW() return size doesn't include terminator */