Skip to content

Commit e06e579

Browse files
RafaelGSSsmithc
andcommitted
deps: call OPENSSL_free after ANS1_STRING_to_UTF8
Co-Authored-By: Chris Smith <[email protected]>
1 parent e72761f commit e06e579

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

deps/ncrypto/ncrypto.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4666,6 +4666,9 @@ 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+
std::string out(reinterpret_cast<const char*>(value_str), value_str_size);
4670+
OPENSSL_free(value_str); // free after copy
4671+
46694672
return {
46704673
std::move(name_str),
46714674
std::string(reinterpret_cast<const char*>(value_str), value_str_size)};
@@ -4839,4 +4842,4 @@ DataPointer KEM::Decapsulate(const EVPKeyPointer& private_key,
48394842

48404843
#endif // OPENSSL_VERSION_MAJOR >= 3
48414844

4842-
} // namespace ncrypto
4845+
} // namespace ncrypto

0 commit comments

Comments
 (0)