Commit 679bf941 authored by louiz’'s avatar louiz’

Only call freeaddrinfo if an actual addrinfo struct has been allocated

parent efb8a11c
......@@ -75,7 +75,7 @@ std::string jidprep(const std::string& original)
struct addrinfo* addr_res = nullptr;
const auto ret = ::getaddrinfo(domain, nullptr, &hints, &addr_res);
auto addrinfo_deleter = utils::make_scope_guard([addr_res] { freeaddrinfo(addr_res); });
auto addrinfo_deleter = utils::make_scope_guard([addr_res] { if (addr_res) freeaddrinfo(addr_res); });
if (ret || !addr_res || (addr_res->ai_family != AF_INET && addr_res->ai_family != AF_INET6))
{ // Not an IP, run nameprep on it
rc = static_cast<Stringprep_rc>(::stringprep(domain, max_jid_part_len,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment