From 5a6485f986fef5c458634130a58ecbfbdc75f7c1 Mon Sep 17 00:00:00 2001 From: Masakazu Kitajo Date: Tue, 13 Jun 2023 17:43:39 -0600 Subject: [PATCH] Fix crash on config reload with BoringSSL --- iocore/net/SSLConfig.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/iocore/net/SSLConfig.cc b/iocore/net/SSLConfig.cc index 884c71e8274..6d47200cf96 100644 --- a/iocore/net/SSLConfig.cc +++ b/iocore/net/SSLConfig.cc @@ -952,7 +952,8 @@ SSLConfigParams::getCTX(const std::string &client_cert, const std::string &key_f SSLError("failed to attach client chain certificate from %s", client_cert.c_str()); goto fail; } - X509_free(cert); + // Do not free cert becasue SSL_CTX_add_extra_chain_cert takes ownership of cert if it succeeds, unlike + // SSL_CTX_use_certificate. cert = PEM_read_bio_X509(biop, nullptr, nullptr, nullptr); }