Use a custom allocator for everything.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3892 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
17
src/tls.c
17
src/tls.c
@ -1,8 +1,9 @@
|
||||
#include "tls.h"
|
||||
|
||||
#include "mem.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define TF_TLS_SCHANNEL
|
||||
#include <malloc.h>
|
||||
#elif defined(__MACH__)
|
||||
#define TF_TLS_APPLE
|
||||
#else
|
||||
@ -1050,7 +1051,7 @@ TlsContext* TlsContext::create()
|
||||
|
||||
tf_tls_context_t* tf_tls_context_create()
|
||||
{
|
||||
tf_tls_context_t* context = malloc(sizeof(tf_tls_context_t));
|
||||
tf_tls_context_t* context = tf_malloc(sizeof(tf_tls_context_t));
|
||||
memset(context, 0, sizeof(*context));
|
||||
#if defined(TF_TLS_OPENSSL)
|
||||
SSL_library_init();
|
||||
@ -1135,7 +1136,7 @@ bool tf_tls_context_add_trusted_certificate(tf_tls_context_t* context, const cha
|
||||
tf_tls_session_t* tf_tls_context_create_session(tf_tls_context_t* context)
|
||||
{
|
||||
#if defined(TF_TLS_OPENSSL)
|
||||
tf_tls_session_t* session = malloc(sizeof(tf_tls_session_t));
|
||||
tf_tls_session_t* session = tf_malloc(sizeof(tf_tls_session_t));
|
||||
memset(session, 0, sizeof(*session));
|
||||
session->context = context;
|
||||
session->bio_in = BIO_new(BIO_s_mem());
|
||||
@ -1151,7 +1152,7 @@ void tf_tls_context_destroy(tf_tls_context_t* context)
|
||||
{
|
||||
#if defined(TF_TLS_OPENSSL)
|
||||
SSL_CTX_free(context->context);
|
||||
free(context);
|
||||
tf_free(context);
|
||||
#elif defined(TF_TLS_APPLE)
|
||||
#elif defined(TF_TLS_SCHANNEL)
|
||||
#endif
|
||||
@ -1166,9 +1167,9 @@ void tf_tls_session_destroy(tf_tls_session_t* session)
|
||||
}
|
||||
if (session->hostname)
|
||||
{
|
||||
free((void*)session->hostname);
|
||||
tf_free((void*)session->hostname);
|
||||
}
|
||||
free(session);
|
||||
tf_free(session);
|
||||
#elif defined(TF_TLS_APPLE)
|
||||
#elif defined(TF_TLS_SCHANNEL)
|
||||
#endif
|
||||
@ -1179,12 +1180,12 @@ void tf_tls_session_set_hostname(tf_tls_session_t* session, const char* hostname
|
||||
#if defined(TF_TLS_OPENSSL)
|
||||
if (session->hostname)
|
||||
{
|
||||
free((void*)session->hostname);
|
||||
tf_free((void*)session->hostname);
|
||||
session->hostname = NULL;
|
||||
}
|
||||
if (hostname)
|
||||
{
|
||||
session->hostname = strdup(hostname);
|
||||
session->hostname = tf_strdup(hostname);
|
||||
}
|
||||
#elif defined(TF_TLS_APPLE)
|
||||
#elif defined(TF_TLS_SCHANNEL)
|
||||
|
Reference in New Issue
Block a user