Fix Coverity 1503325 use after free

Another reference counting false positive, now negated.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/18014)
This commit is contained in:
Pauli 2022-04-01 12:20:26 +11:00
parent 66cb4fcdc5
commit 71b7f34978

View File

@ -202,6 +202,8 @@ static int evp_cipher_init_internal(EVP_CIPHER_CTX *ctx,
return 0;
}
EVP_CIPHER_free(ctx->fetched_cipher);
/* Coverity false positive, the reference counting is confusing it */
/* coverity[use_after_free] */
ctx->fetched_cipher = (EVP_CIPHER *)cipher;
}
ctx->cipher = cipher;