Commit 986dbbbe authored by Rob Percival's avatar Rob Percival Committed by Matt Caswell
Browse files

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: default avatarRich Salz <rsalz@openssl.org>
Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
parent cdb2a603
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);