Skip to content

Commit

Permalink
Fix false memory leak in DHCP server
Browse files Browse the repository at this point in the history
  • Loading branch information
mafik committed Dec 7, 2023
1 parent 8080cce commit 4cb2a68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dhcp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,8 @@ IP ChooseInformIP(const PacketView &request, string &error) {
Server server;

Server::Entry::Entry(Server &server, IP ip, MAC mac, Str hostname)
: Expirable(), ip(ip), mac(mac), hostname(hostname) {
: Expirable(chrono::steady_clock::time_point::max()), ip(ip), mac(mac),
hostname(hostname) {
server.entries_by_ip.insert(this);
server.entries_by_mac.insert(this);
}
Expand Down Expand Up @@ -928,8 +929,7 @@ void Server::HandleRequest(string_view buf, IP source_ip, uint16_t port) {
ERROR << "DHCP server received an INFORM packet with a mismatching "
"source IP: "
<< source_ip.to_string() << " (source IP) vs "
<< packet.client_ip.to_string() << " (DHCP client_ip)"
<< "\n"
<< packet.client_ip.to_string() << " (DHCP client_ip)" << "\n"
<< packet.to_string();
return;
}
Expand Down

0 comments on commit 4cb2a68

Please sign in to comment.