This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new f87600ef3 Destroy ssl context after use. (#8531)
f87600ef3 is described below
commit f87600ef34e4b69160f641b704c9a8b10d56ac2d
Author: Damian Meden <[email protected]>
AuthorDate: Tue Nov 23 10:22:49 2021 +0000
Destroy ssl context after use. (#8531)
As per the docs this needs to be released after use, this was missing from
the cert_reporting_tool plugin.
This also fixes the example in the docs.
(cherry picked from commit 57015b77d45acc7bccea5295a26168faa1d6ef52)
---
doc/developer-guide/api/functions/TSSslClientContext.en.rst | 7 ++++++-
plugins/experimental/cert_reporting_tool/cert_reporting_tool.cc | 5 +++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/doc/developer-guide/api/functions/TSSslClientContext.en.rst
b/doc/developer-guide/api/functions/TSSslClientContext.en.rst
index ca14c17b1..25cc070d7 100644
--- a/doc/developer-guide/api/functions/TSSslClientContext.en.rst
+++ b/doc/developer-guide/api/functions/TSSslClientContext.en.rst
@@ -59,4 +59,9 @@ Server source distribution. It demonstrates how to use
:func:`TSSslClientContext
.. literalinclude::
../../../../example/plugins/c-api/client_context_dump/client_context_dump.cc
:language: c
- :lines: 137-145
+ :lines: 154-166
+
+
+.. literalinclude::
../../../../example/plugins/c-api/client_context_dump/client_context_dump.cc
+ :language: c
+ :lines: 51-55
diff --git a/plugins/experimental/cert_reporting_tool/cert_reporting_tool.cc
b/plugins/experimental/cert_reporting_tool/cert_reporting_tool.cc
index fd6ab40b5..263b90def 100644
--- a/plugins/experimental/cert_reporting_tool/cert_reporting_tool.cc
+++ b/plugins/experimental/cert_reporting_tool/cert_reporting_tool.cc
@@ -51,9 +51,9 @@ asn1_string_extract(ASN1_STRING *s)
void
dump_context(const char *ca_path, const char *ck_path)
{
- SSL_CTX *ctx = reinterpret_cast<SSL_CTX
*>(TSSslClientContextFindByName(ca_path, ck_path));
+ TSSslContext ctx = TSSslClientContextFindByName(ca_path, ck_path);
if (ctx) {
- SSL *s = SSL_new(ctx);
+ SSL *s = SSL_new(reinterpret_cast<SSL_CTX *>(ctx));
if (s) {
char *data = nullptr;
long length = 0;
@@ -137,6 +137,7 @@ dump_context(const char *ca_path, const char *ck_path)
}
}
SSL_free(s);
+ TSSslContextDestroy(ctx);
}
}