tls: fix memory leak when using test cert 97/43697/2
authorDave Wallace <[email protected]>
Fri, 12 Sep 2025 14:39:26 +0000 (10:39 -0400)
committerFlorin Coras <[email protected]>
Fri, 12 Sep 2025 16:33:31 +0000 (16:33 +0000)
Type: fix

Change-Id: I4bf4c6c37f9ee6e262730c372f16fbc086a2d13c
Signed-off-by: Dave Wallace <[email protected]>
src/plugins/tlsopenssl/tls_openssl.c

index 6ccb17f..9648d6f 100644 (file)
@@ -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);