From 0e04674e964b905e67e3d215bcf888932c92765f Mon Sep 17 00:00:00 2001 From: Filipe DA SILVA Date: Wed, 16 Sep 2015 22:25:31 -0400 Subject: RT4047: Set reference count earlier Make sure it's valid very early. Signed-off-by: Rich Salz Reviewed-by: Richard Levitte --- ssl/ssl_cert.c | 2 +- ssl/ssl_lib.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'ssl') diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 05a4447450..ecef7bddc8 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -192,6 +192,7 @@ CERT *ssl_cert_dup(CERT *cert) return (NULL); } + ret->references = 1; ret->key = &ret->pkeys[cert->key - cert->pkeys]; #ifndef OPENSSL_NO_RSA @@ -278,7 +279,6 @@ CERT *ssl_cert_dup(CERT *cert) } } - ret->references = 1; /* Configured sigalgs copied across */ if (cert->conf_sigalgs) { ret->conf_sigalgs = OPENSSL_malloc(cert->conf_sigalgslen); diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 28b71082ab..e794d82058 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -286,6 +286,7 @@ SSL *SSL_new(SSL_CTX *ctx) s->options = ctx->options; s->mode = ctx->mode; s->max_cert_list = ctx->max_cert_list; + s->references = 1; /* * Earlier library versions used to copy the pointer to the CERT, not @@ -372,7 +373,6 @@ SSL *SSL_new(SSL_CTX *ctx) if (!s->method->ssl_new(s)) goto err; - s->references = 1; s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1; if (!SSL_clear(s)) -- cgit v1.2.3