From 5e1ab9fffb8399fcc51ab1b592d0fffef4e418aa Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Mon, 10 Nov 2025 11:21:49 -0300 Subject: [PATCH] deps: call OPENSSL_free after ANS1_STRING_to_UTF8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Chris Smith Signed-off-by: RafaelGSS PR-URL: https://github.com/nodejs/node/pull/60609 Refs: https://github.com/nodejs/node/issues/58380 Reviewed-By: Matteo Collina Reviewed-By: Marco Ippolito Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Juan José Arboleda --- deps/ncrypto/ncrypto.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc index e1c2da6969a..461819ce0fa 100644 --- a/deps/ncrypto/ncrypto.cc +++ b/deps/ncrypto/ncrypto.cc @@ -4666,9 +4666,10 @@ std::pair X509Name::Iterator::operator*() const { unsigned char* value_str; int value_str_size = ASN1_STRING_to_UTF8(&value_str, value); - return { - std::move(name_str), - std::string(reinterpret_cast(value_str), value_str_size)}; + std::string out(reinterpret_cast(value_str), value_str_size); + OPENSSL_free(value_str); // free after copy + + return {std::move(name_str), std::move(out)}; } // ============================================================================