Set reference count earlier
Backport of 0e04674e96
Reviewed-by: Steve Henson <steve@openssl.org>
RT #4047, #4110, MR #1356
This commit is contained in:
@@ -227,6 +227,7 @@ CERT *ssl_cert_dup(CERT *cert)
|
|||||||
|
|
||||||
memset(ret, 0, sizeof(CERT));
|
memset(ret, 0, sizeof(CERT));
|
||||||
|
|
||||||
|
ret->references = 1;
|
||||||
ret->key = &ret->pkeys[cert->key - &cert->pkeys[0]];
|
ret->key = &ret->pkeys[cert->key - &cert->pkeys[0]];
|
||||||
/*
|
/*
|
||||||
* or ret->key = ret->pkeys + (cert->key - cert->pkeys), if you find that
|
* or ret->key = ret->pkeys + (cert->key - cert->pkeys), if you find that
|
||||||
@@ -325,7 +326,6 @@ CERT *ssl_cert_dup(CERT *cert)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ret->references = 1;
|
|
||||||
/*
|
/*
|
||||||
* Set digests to defaults. NB: we don't copy existing values as they
|
* Set digests to defaults. NB: we don't copy existing values as they
|
||||||
* will be set during handshake.
|
* will be set during handshake.
|
||||||
|
@@ -307,6 +307,7 @@ SSL *SSL_new(SSL_CTX *ctx)
|
|||||||
s->options = ctx->options;
|
s->options = ctx->options;
|
||||||
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;
|
||||||
|
|
||||||
if (ctx->cert != NULL) {
|
if (ctx->cert != NULL) {
|
||||||
/*
|
/*
|
||||||
@@ -405,7 +406,6 @@ SSL *SSL_new(SSL_CTX *ctx)
|
|||||||
if (!s->method->ssl_new(s))
|
if (!s->method->ssl_new(s))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
s->references = 1;
|
|
||||||
s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1;
|
s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1;
|
||||||
|
|
||||||
SSL_clear(s);
|
SSL_clear(s);
|
||||||
|
Reference in New Issue
Block a user