engine: fix double free on error path.
authorPauli <pauli@openssl.org>
Sun, 18 Apr 2021 22:57:18 +0000 (08:57 +1000)
committerPauli <pauli@openssl.org>
Tue, 20 Apr 2021 23:21:28 +0000 (09:21 +1000)
commite41290cfc007b833b393864cf12e0d8d815b7081
treebe18a8546da508ea9505429896f04fe9744404b6
parenta3dea76f742896b7d75a0c0529c0af1e628bd853
engine: fix double free on error path.

In function try_decode_PKCS8Encrypted, p8 is freed via X509_SIG_free() at line 481.
If function new_EMBEDDED() returns a null pointer at line 483, the execution will goto nop8.
In the nop8 branch, p8 is freed again at line 491.

Bug reported by @Yunlongs

Fixes #14915

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

(cherry picked from commit efe8d69daa1a68be0a7f0f73220947c848e7ed1d)
crypto/store/loader_file.c