aboutsummaryrefslogtreecommitdiff
path: root/crypto/asn1/x_pkey.c
diff options
context:
space:
mode:
authorFilipe DA SILVA <fdasilvaYY@gmail.com>2015-09-16 22:25:31 -0400
committerRich Salz <rsalz@openssl.org>2015-09-17 11:58:24 -0400
commit0e04674e964b905e67e3d215bcf888932c92765f (patch)
tree07009b277704aa716f12cab631c1ec46b56ac441 /crypto/asn1/x_pkey.c
parent20ca916d7db4fe6feada88d0bea1489123339c7c (diff)
downloadopenssl-0e04674e964b905e67e3d215bcf888932c92765f.zip
openssl-0e04674e964b905e67e3d215bcf888932c92765f.tar.gz
openssl-0e04674e964b905e67e3d215bcf888932c92765f.tar.bz2
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>
Diffstat (limited to 'crypto/asn1/x_pkey.c')
-rw-r--r--crypto/asn1/x_pkey.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/asn1/x_pkey.c b/crypto/asn1/x_pkey.c
index 0665aab..961b913 100644
--- a/crypto/asn1/x_pkey.c
+++ b/crypto/asn1/x_pkey.c
@@ -70,11 +70,12 @@ X509_PKEY *X509_PKEY_new(void)
if (!ret)
goto err;
+ ret->references = 1;
ret->enc_algor = X509_ALGOR_new();
ret->enc_pkey = ASN1_OCTET_STRING_new();
if (!ret->enc_algor || !ret->enc_pkey)
goto err;
- ret->references = 1;
+
return ret;
err:
X509_PKEY_free(ret);