From 986dbbbeffb0f998aa1e9aa80d24ddb4d10d0f73 Mon Sep 17 00:00:00 2001 From: Rob Percival Date: Tue, 23 Aug 2016 16:55:09 +0100 Subject: 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 Reviewed-by: Matt Caswell --- crypto/ct/ct_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crypto/ct') 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); -- cgit v1.2.3