Use SSL_CTX_up_ref to up-ref an SSL_CTX.

We have this function now. Probably good to use it.

Change-Id: I00fe1f4cf5c8cb6f61a8f6600cac4667e95ad7f3
Reviewed-on: https://boringssl-review.googlesource.com/13040
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
David Benjamin 2016-12-22 15:54:51 -05:00 committed by CQ bot account: commit-bot@chromium.org
parent a81967b47c
commit f650c71ac0

View File

@ -419,9 +419,9 @@ SSL *SSL_new(SSL_CTX *ctx) {
ssl->quiet_shutdown = ctx->quiet_shutdown;
ssl->max_send_fragment = ctx->max_send_fragment;
CRYPTO_refcount_inc(&ctx->references);
SSL_CTX_up_ref(ctx);
ssl->ctx = ctx;
CRYPTO_refcount_inc(&ctx->references);
SSL_CTX_up_ref(ctx);
ssl->initial_ctx = ctx;
if (ctx->supported_group_list) {
@ -2266,8 +2266,8 @@ SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) {
ssl_cert_free(ssl->cert);
ssl->cert = ssl_cert_dup(ctx->cert);
CRYPTO_refcount_inc(&ctx->references);
SSL_CTX_free(ssl->ctx); /* decrement reference count */
SSL_CTX_up_ref(ctx);
SSL_CTX_free(ssl->ctx);
ssl->ctx = ctx;
ssl->sid_ctx_length = ctx->sid_ctx_length;