Commit d4412537 authored by louiz’'s avatar louiz’

Free the result pointer provided by udns

Fix a memory leak that would occur on every DNS request, when using udns
parent a0a2de3b
...@@ -114,6 +114,7 @@ void Resolver::start_resolving(const std::string& hostname, const std::string& p ...@@ -114,6 +114,7 @@ void Resolver::start_resolving(const std::string& hostname, const std::string& p
Resolver* resolver = static_cast<Resolver*>(data); Resolver* resolver = static_cast<Resolver*>(data);
resolver->on_hostname6_resolved(result); resolver->on_hostname6_resolved(result);
resolver->after_resolved(); resolver->after_resolved();
std::free(result);
}; };
auto hostname4_resolved = [](dns_ctx*, dns_rr_a4* result, void* data) auto hostname4_resolved = [](dns_ctx*, dns_rr_a4* result, void* data)
...@@ -121,6 +122,7 @@ void Resolver::start_resolving(const std::string& hostname, const std::string& p ...@@ -121,6 +122,7 @@ void Resolver::start_resolving(const std::string& hostname, const std::string& p
Resolver* resolver = static_cast<Resolver*>(data); Resolver* resolver = static_cast<Resolver*>(data);
resolver->on_hostname4_resolved(result); resolver->on_hostname4_resolved(result);
resolver->after_resolved(); resolver->after_resolved();
std::free(result);
}; };
DNSHandler::watch(); DNSHandler::watch();
......
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