From: Rob Percival Date: Tue, 23 Aug 2016 15:55:09 +0000 (+0100) Subject: Prevent double-free of CTLOG public key X-Git-Tag: OpenSSL_1_1_0~60 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=986dbbbeffb0f998aa1e9aa80d24ddb4d10d0f73 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 --- 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);