Skip to content

Commit a61e5d8

Browse files
RafaelGSSsmithc
authored andcommitted
deps: call OPENSSL_free after ANS1_STRING_to_UTF8
Co-Authored-By: Chris Smith <chrismith@vista.com> Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: #60609 Refs: #58380 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
1 parent e9b68e6 commit a61e5d8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

deps/ncrypto/ncrypto.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4666,9 +4666,10 @@ std::pair<std::string, std::string> X509Name::Iterator::operator*() const {
46664666
unsigned char* value_str;
46674667
int value_str_size = ASN1_STRING_to_UTF8(&value_str, value);
46684668

4669-
return {
4670-
std::move(name_str),
4671-
std::string(reinterpret_cast<const char*>(value_str), value_str_size)};
4669+
std::string out(reinterpret_cast<const char*>(value_str), value_str_size);
4670+
OPENSSL_free(value_str); // free after copy
4671+
4672+
return {std::move(name_str), std::move(out)};
46724673
}
46734674

46744675
// ============================================================================

0 commit comments

Comments
 (0)