mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-04-29 19:24:37 +00:00
Fix error handling in SSL_new
Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4580)
This commit is contained in:
parent
fe6fcd3154
commit
e6b10c344e
@ -624,9 +624,13 @@ SSL *SSL_new(SSL_CTX *ctx)
|
|||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
s->references = 1;
|
||||||
s->lock = CRYPTO_THREAD_lock_new();
|
s->lock = CRYPTO_THREAD_lock_new();
|
||||||
if (s->lock == NULL)
|
if (s->lock == NULL) {
|
||||||
|
OPENSSL_free(s);
|
||||||
|
s = NULL;
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If not using the standard RAND (say for fuzzing), then don't use a
|
* If not using the standard RAND (say for fuzzing), then don't use a
|
||||||
@ -639,10 +643,8 @@ SSL *SSL_new(SSL_CTX *ctx)
|
|||||||
if (s->drbg == NULL
|
if (s->drbg == NULL
|
||||||
|| RAND_DRBG_instantiate(s->drbg,
|
|| RAND_DRBG_instantiate(s->drbg,
|
||||||
(const unsigned char *) SSL_version_str,
|
(const unsigned char *) SSL_version_str,
|
||||||
sizeof(SSL_version_str) - 1) == 0) {
|
sizeof(SSL_version_str) - 1) == 0)
|
||||||
CRYPTO_THREAD_lock_free(s->lock);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RECORD_LAYER_init(&s->rlayer, s);
|
RECORD_LAYER_init(&s->rlayer, s);
|
||||||
@ -653,7 +655,6 @@ SSL *SSL_new(SSL_CTX *ctx)
|
|||||||
s->max_proto_version = ctx->max_proto_version;
|
s->max_proto_version = ctx->max_proto_version;
|
||||||
s->mode = ctx->mode;
|
s->mode = ctx->mode;
|
||||||
s->max_cert_list = ctx->max_cert_list;
|
s->max_cert_list = ctx->max_cert_list;
|
||||||
s->references = 1;
|
|
||||||
s->max_early_data = ctx->max_early_data;
|
s->max_early_data = ctx->max_early_data;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user