Fix memory leak in x509_check_cert_hostname bif

This commit is contained in:
Johanna Amann 2021-06-30 10:12:00 +01:00
parent 93d7778f97
commit 4ad5d2031b

View file

@ -1060,8 +1060,13 @@ function x509_check_cert_hostname%(cert_opaque: opaque of x509, hostname: string
#endif
std::string_view nameview {name, len};
if ( check_hostname(hostview, nameview) )
return zeek::make_intrusive<zeek::StringVal>(len, name);
{
auto retval = zeek::make_intrusive<zeek::StringVal>(len, name);
GENERAL_NAMES_free(altname);
return retval;
}
}
GENERAL_NAMES_free(altname);
}
else
{