mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 03:34:39 +02:00
check for NULL user pointers on basic inits
This commit is contained in:
17
src/ssl.c
17
src/ssl.c
@@ -66,9 +66,14 @@
|
|||||||
|
|
||||||
CYASSL_CTX* CyaSSL_CTX_new(CYASSL_METHOD* method)
|
CYASSL_CTX* CyaSSL_CTX_new(CYASSL_METHOD* method)
|
||||||
{
|
{
|
||||||
CYASSL_CTX* ctx = (CYASSL_CTX*) XMALLOC(sizeof(CYASSL_CTX), 0,
|
CYASSL_CTX* ctx = NULL;
|
||||||
DYNAMIC_TYPE_CTX);
|
|
||||||
CYASSL_ENTER("CYASSL_CTX_new");
|
CYASSL_ENTER("CYASSL_CTX_new");
|
||||||
|
|
||||||
|
if (method == NULL)
|
||||||
|
return ctx;
|
||||||
|
|
||||||
|
ctx = (CYASSL_CTX*) XMALLOC(sizeof(CYASSL_CTX), 0, DYNAMIC_TYPE_CTX);
|
||||||
if (ctx)
|
if (ctx)
|
||||||
InitSSL_Ctx(ctx, method);
|
InitSSL_Ctx(ctx, method);
|
||||||
|
|
||||||
@@ -88,8 +93,14 @@ void CyaSSL_CTX_free(CYASSL_CTX* ctx)
|
|||||||
|
|
||||||
CYASSL* CyaSSL_new(CYASSL_CTX* ctx)
|
CYASSL* CyaSSL_new(CYASSL_CTX* ctx)
|
||||||
{
|
{
|
||||||
CYASSL* ssl = (CYASSL*) XMALLOC(sizeof(CYASSL), ctx->heap,DYNAMIC_TYPE_SSL);
|
CYASSL* ssl = NULL;
|
||||||
|
|
||||||
CYASSL_ENTER("SSL_new");
|
CYASSL_ENTER("SSL_new");
|
||||||
|
|
||||||
|
if (ctx == NULL)
|
||||||
|
return ssl;
|
||||||
|
|
||||||
|
ssl = (CYASSL*) XMALLOC(sizeof(CYASSL), ctx->heap,DYNAMIC_TYPE_SSL);
|
||||||
if (ssl)
|
if (ssl)
|
||||||
if (InitSSL(ssl, ctx) < 0) {
|
if (InitSSL(ssl, ctx) < 0) {
|
||||||
FreeSSL(ssl);
|
FreeSSL(ssl);
|
||||||
|
Reference in New Issue
Block a user