RT4047: Set reference count earlier

Make sure it's valid very early.

Signed-off-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Filipe DA SILVA
2015-09-16 22:25:31 -04:00
committed by Rich Salz
parent 20ca916d7d
commit 0e04674e96
3 changed files with 4 additions and 3 deletions

View File

@@ -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))