Initializing handles with calloc now.

This commit is contained in:
Armin Novak 2015-03-11 18:09:22 +01:00
parent 9153af6a3e
commit 98b0f37020
4 changed files with 5 additions and 7 deletions

View File

@ -138,8 +138,8 @@ BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpP
return FALSE;
}
pReadPipe = (WINPR_PIPE*) malloc(sizeof(WINPR_PIPE));
pWritePipe = (WINPR_PIPE*) malloc(sizeof(WINPR_PIPE));
pReadPipe = (WINPR_PIPE*) calloc(1, sizeof(WINPR_PIPE));
pWritePipe = (WINPR_PIPE*) calloc(1, sizeof(WINPR_PIPE));
if (!pReadPipe || !pWritePipe)
{

View File

@ -123,13 +123,11 @@ BOOL LogonUserA(LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword,
if (!lpszUsername)
return FALSE;
token = (WINPR_ACCESS_TOKEN*) malloc(sizeof(WINPR_ACCESS_TOKEN));
token = (WINPR_ACCESS_TOKEN*) calloc(1, sizeof(WINPR_ACCESS_TOKEN));
if (!token)
return FALSE;
ZeroMemory(token, sizeof(WINPR_ACCESS_TOKEN));
WINPR_HANDLE_SET_TYPE(token, HANDLE_TYPE_ACCESS_TOKEN);
token->cb.GetFd = LogonUserGetFd;

View File

@ -73,7 +73,7 @@ HANDLE CreateMutexW(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner,
HANDLE handle = NULL;
WINPR_MUTEX* mutex;
mutex = (WINPR_MUTEX*) malloc(sizeof(WINPR_MUTEX));
mutex = (WINPR_MUTEX*) calloc(1, sizeof(WINPR_MUTEX));
if (mutex)
{

View File

@ -116,7 +116,7 @@ HANDLE CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lIniti
HANDLE handle;
WINPR_SEMAPHORE* semaphore;
semaphore = (WINPR_SEMAPHORE*) malloc(sizeof(WINPR_SEMAPHORE));
semaphore = (WINPR_SEMAPHORE*) calloc(1, sizeof(WINPR_SEMAPHORE));
if (!semaphore)
return NULL;