summaryrefslogtreecommitdiffstats
path: root/crypto/ct
diff options
context:
space:
mode:
authorRob Percival <robpercival@google.com>2016-08-23 16:55:09 +0100
committerMatt Caswell <matt@openssl.org>2016-08-23 20:17:14 +0100
commit986dbbbeffb0f998aa1e9aa80d24ddb4d10d0f73 (patch)
tree95f4a83fd94184922f470191346b77793d06571f /crypto/ct
parentcdb2a60347f988037d29adc7e4415e9c66c8a5a5 (diff)
Prevent double-free of CTLOG public key
Previously, if ct_v1_log_id_from_pkey failed, public_key would be freed by CTLOG_free at the end of the function, and then again by the caller (who would assume ownership was not transferred when CTLOG_new returned NULL). Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/ct')
-rw-r--r--crypto/ct/ct_log.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/ct/ct_log.c b/crypto/ct/ct_log.c
index 13f7f39148..6db4c3eba1 100644
--- a/crypto/ct/ct_log.c
+++ b/crypto/ct/ct_log.c
@@ -247,10 +247,10 @@ CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
goto err;
}
- ret->public_key = public_key;
if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
goto err;
+ ret->public_key = public_key;
return ret;
err:
CTLOG_free(ret);