mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Treat OOM cases
This commit is contained in:
@@ -307,25 +307,34 @@ rdpNtlmHttp* ntlm_http_new()
|
||||
{
|
||||
rdpNtlmHttp* ntlm_http;
|
||||
|
||||
ntlm_http = (rdpNtlmHttp*) malloc(sizeof(rdpNtlmHttp));
|
||||
ntlm_http = (rdpNtlmHttp *)calloc(1, sizeof(rdpNtlmHttp));
|
||||
|
||||
if (ntlm_http != NULL)
|
||||
{
|
||||
ZeroMemory(ntlm_http, sizeof(rdpNtlmHttp));
|
||||
ntlm_http->ntlm = ntlm_new();
|
||||
ntlm_http->context = http_context_new();
|
||||
}
|
||||
if (!ntlm_http)
|
||||
return NULL;
|
||||
|
||||
ntlm_http->ntlm = ntlm_new();
|
||||
if (!ntlm_http->ntlm)
|
||||
goto out_free;
|
||||
|
||||
ntlm_http->context = http_context_new();
|
||||
if (!ntlm_http->context)
|
||||
goto out_free_ntlm;
|
||||
|
||||
return ntlm_http;
|
||||
|
||||
out_free_ntlm:
|
||||
ntlm_free(ntlm_http->ntlm);
|
||||
out_free:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ntlm_http_free(rdpNtlmHttp* ntlm_http)
|
||||
{
|
||||
if (ntlm_http != NULL)
|
||||
{
|
||||
ntlm_free(ntlm_http->ntlm);
|
||||
http_context_free(ntlm_http->context);
|
||||
if (!ntlm_http)
|
||||
return;
|
||||
|
||||
free(ntlm_http);
|
||||
}
|
||||
ntlm_free(ntlm_http->ntlm);
|
||||
http_context_free(ntlm_http->context);
|
||||
|
||||
free(ntlm_http);
|
||||
}
|
||||
|
||||
@@ -286,14 +286,7 @@ void ntlm_client_uninit(rdpNtlm* ntlm)
|
||||
|
||||
rdpNtlm* ntlm_new()
|
||||
{
|
||||
rdpNtlm* ntlm = (rdpNtlm*) malloc(sizeof(rdpNtlm));
|
||||
|
||||
if (ntlm != NULL)
|
||||
{
|
||||
ZeroMemory(ntlm, sizeof(rdpNtlm));
|
||||
}
|
||||
|
||||
return ntlm;
|
||||
return (rdpNtlm *)calloc(1, sizeof(rdpNtlm));
|
||||
}
|
||||
|
||||
void ntlm_free(rdpNtlm* ntlm)
|
||||
|
||||
@@ -264,15 +264,14 @@ rdpCertificateStore* certificate_store_new(rdpSettings* settings)
|
||||
{
|
||||
rdpCertificateStore* certificate_store;
|
||||
|
||||
certificate_store = (rdpCertificateStore*) malloc(sizeof(rdpCertificateStore));
|
||||
certificate_store = (rdpCertificateStore *)calloc(1, sizeof(rdpCertificateStore));
|
||||
|
||||
if (certificate_store != NULL)
|
||||
{
|
||||
ZeroMemory(certificate_store, sizeof(rdpCertificateStore));
|
||||
if (!certificate_store)
|
||||
return NULL;
|
||||
|
||||
certificate_store->settings = settings;
|
||||
certificate_store_init(certificate_store);
|
||||
}
|
||||
certificate_store->settings = settings;
|
||||
certificate_store_init(certificate_store);
|
||||
/* TODO: certificate_store_init should not fail silently */
|
||||
|
||||
return certificate_store;
|
||||
}
|
||||
|
||||
@@ -100,8 +100,9 @@ HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize
|
||||
HANDLE handle;
|
||||
WINPR_THREAD* thread;
|
||||
|
||||
thread = (WINPR_THREAD*) malloc(sizeof(WINPR_THREAD));
|
||||
ZeroMemory(thread, sizeof(WINPR_THREAD));
|
||||
thread = (WINPR_THREAD*) calloc(1, sizeof(WINPR_THREAD));
|
||||
if (!thread)
|
||||
return NULL;
|
||||
|
||||
thread->started = FALSE;
|
||||
thread->dwStackSize = dwStackSize;
|
||||
|
||||
Reference in New Issue
Block a user