From f2b8edd1e25331496c957abfe1a76bf2065b781b Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 29 Oct 2017 21:46:12 +0900 Subject: [PATCH] nghttpx: Fix memory leak --- src/shrpx_mruby_module_env.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shrpx_mruby_module_env.cc b/src/shrpx_mruby_module_env.cc index ba220e1a..06a5195b 100644 --- a/src/shrpx_mruby_module_env.cc +++ b/src/shrpx_mruby_module_env.cc @@ -161,6 +161,7 @@ mrb_value env_get_tls_client_fingerprint(mrb_state *mrb, mrb_value self) { // Fingerprint is SHA-256, so we need 32 bytes buffer. std::array buf; auto slen = tls::get_x509_fingerprint(buf.data(), buf.size(), x); + X509_free(x); if (slen == -1) { mrb_raise(mrb, E_RUNTIME_ERROR, "could not compute client fingerprint"); } @@ -192,6 +193,7 @@ mrb_value env_get_tls_client_subject_name(mrb_state *mrb, mrb_value self) { auto &balloc = downstream->get_block_allocator(); auto name = tls::get_x509_subject_name(balloc, x); + X509_free(x); return mrb_str_new(mrb, name.c_str(), name.size()); } } // namespace