]> git.ipfire.org Git - thirdparty/openssl.git/commit
x509: fix mem leak on error path
authorNikola Pajkovsky <nikolap@openssl.org>
Mon, 22 Sep 2025 10:17:16 +0000 (12:17 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 23 Sep 2025 14:43:34 +0000 (16:43 +0200)
commit1f183bd83a55795381db44bef9825085d3b26d87
treee19fb0b6c6b03a1ef76d8414c01599f99994f57e
parent04307541e203965e2d5512d971472010a78be330
x509: fix mem leak on error path

The x509_store_add() creates X509_OBJECT wrapping either X509 or
X509_CRL. However, if you set the type to X509_LU_NONE before
X509_OBJECT_free then it skips the free on the wrapped type and just
calls OPENSSL_free on the object itself. Hence, leaking wrapped
object.

Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28631)

(cherry picked from commit 8a4ef31f3ab9c8e512d29600ccc833cf03533b9e)
crypto/x509/x509_lu.c