summaryrefslogtreecommitdiffstats
path: root/crypto/evp/p_lib.c
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2016-09-07 09:41:20 -0400
committerRich Salz <rsalz@openssl.org>2016-09-07 09:41:20 -0400
commitd65c3615f6c658478503f4862f8055203a98038c (patch)
tree8dbb82b1d648af787ddc3736e9959f4fb936361d /crypto/evp/p_lib.c
parent01c09f9fde5793e0b3712d602b02e2aed4908e8d (diff)
GH1537: Avoid double-free in the EVP_PKEY API
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/evp/p_lib.c')
-rw-r--r--crypto/evp/p_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index a4dcf581c7..9828620552 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -398,6 +398,7 @@ void EVP_PKEY_free(EVP_PKEY *x)
return;
REF_ASSERT_ISNT(i < 0);
EVP_PKEY_free_it(x);
+ CRYPTO_THREAD_lock_free(x->lock);
sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
OPENSSL_free(x);
}
@@ -413,7 +414,6 @@ static void EVP_PKEY_free_it(EVP_PKEY *x)
ENGINE_finish(x->engine);
x->engine = NULL;
#endif
- CRYPTO_THREAD_lock_free(x->lock);
}
static int unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent,