From 0dbd3725a2939f904b85213c41d72d768b02c6f9 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Fri, 12 Sep 2025 10:39:26 -0400 Subject: [PATCH] tls: fix memory leak when using test cert Type: fix Change-Id: I4bf4c6c37f9ee6e262730c372f16fbc086a2d13c Signed-off-by: Dave Wallace --- src/plugins/tlsopenssl/tls_openssl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c index 6ccb17f7391..9648d6f66f9 100644 --- a/src/plugins/tlsopenssl/tls_openssl.c +++ b/src/plugins/tlsopenssl/tls_openssl.c @@ -1438,12 +1438,14 @@ tls_init_ca_chain (void) cert_bio = BIO_new (BIO_s_mem ()); BIO_write (cert_bio, test_srv_crt_rsa, test_srv_crt_rsa_len); testcert = PEM_read_bio_X509 (cert_bio, NULL, NULL, NULL); + BIO_free (cert_bio); if (!testcert) { clib_warning ("unable to parse certificate"); return -1; } X509_STORE_add_cert (om->cert_store, testcert); + X509_free (testcert); rv = 0; } return (rv < 0 ? -1 : 0); -- 2.16.6