Update provider_util.c to correctly handle ENGINE references
authorMatt Caswell <matt@openssl.org>
Fri, 15 Oct 2021 15:28:53 +0000 (16:28 +0100)
committerMatt Caswell <matt@openssl.org>
Tue, 19 Oct 2021 15:27:14 +0000 (16:27 +0100)
commit51100ac4b5bea7a9e9f57ede350d655243b526b1
treed42d19f45cc5cb60928bc4497dcba4e9db12b4f9
parent3d292eeab27f69511453d3726e8c35532cfc159d
Update provider_util.c to correctly handle ENGINE references

provider_util.c failed to free ENGINE references when clearing a cipher
or a digest. Additionally ciphers and digests were not copied correctly,
which would lead to double-frees if it were not for the previously
mentioned leaks.

Fixes #16845

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16846)

(cherry picked from commit 86c15ba87488f88e6191f098ff154f79ce91847b)
providers/common/provider_util.c