]> git.ipfire.org Git - thirdparty/openssl.git/commit - apps/lib/apps.c
Fix memory leak in load_key_certs_crls() when using stdin.
authorShane Lontis <shane.lontis@oracle.com>
Wed, 28 Apr 2021 07:22:50 +0000 (17:22 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Fri, 30 Apr 2021 06:04:53 +0000 (16:04 +1000)
commit857c223bf73f6d3ec91567cf341c5267392a3e66
tree6c92ae78d493d09096d6567e2f562abf91813d11
parente9d62da6c305d947530d91e412fdb21a8d8e3510
Fix memory leak in load_key_certs_crls() when using stdin.

A newly created BIO object within this function calls
OSSL_STORE_attach() which increases the ref count to 2.
OSSL_STORE_close() then decrements the ref count by 1, so the BIO still
remains.

The following new test was picking up this leak using..
> valgrind openssl crl -hash -noout < test/testcrl.pem

Not quite sure why the existing tests were not picking this up
since they appear to run through a similiar path.. such as
> valgrind openssl pkey < test-runs/test_rsa/rsa-pkcs8-ff.dd

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15058)
apps/lib/apps.c