diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index c5afd2ead24..c7badbf85bc 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -1174,12 +1174,13 @@ fetch_ssl_cb_verify_crt(int verified, X509_STORE_CTX *ctx) */ if (!verified && X509_STORE_CTX_get_error(ctx) == X509_V_ERR_UNABLE_TO_GET_CRL) { if ((crt = X509_STORE_CTX_get_current_cert(ctx)) != NULL && - (name = X509_get_subject_name(crt)) != NULL) - str = X509_NAME_oneline(name, 0, 0); - if (X509_STORE_CTX_get_error_depth(ctx) != 0) { - fetch_info("No CRL was provided for CA %s", str); + (name = X509_get_subject_name(crt)) != NULL) { + if (X509_STORE_CTX_get_error_depth(ctx) != 0) { + str = X509_NAME_oneline(name, 0, 0); + fetch_info("No CRL was provided for CA %s", str); + OPENSSL_free(str); + } } - OPENSSL_free(str); verified = 1; }