Skip to content

Commit

Permalink
Leak fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Sep 11, 2024
1 parent bf66ccd commit 290e986
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Prefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ Prefs::Prefs(Ntop *_ntop) {
ls_proto = NULL;
has_cmdl_trace_lvl = false;

dns_servers = new (std::nothrow) ServerConfiguration();
ntp_servers = new (std::nothrow) ServerConfiguration();
dns_servers = new (std::nothrow) ServerConfiguration();
ntp_servers = new (std::nothrow) ServerConfiguration();
dhcp_servers = new (std::nothrow) ServerConfiguration();
smtp_servers = new (std::nothrow) ServerConfiguration();

Expand Down Expand Up @@ -316,6 +316,11 @@ Prefs::~Prefs() {
if(modbus_allowed_function_codes)
ndpi_bitmap_free(modbus_allowed_function_codes);
#endif

if(dns_servers) delete dns_servers;
if(ntp_servers) delete ntp_servers;
if(dhcp_servers) delete dhcp_servers;
if(smtp_servers) delete smtp_servers;
}

/* ******************************************* */
Expand Down Expand Up @@ -3198,4 +3203,4 @@ bool Prefs::isDHCPServer(IpAddress *ip, u_int16_t vlan_id) {

bool Prefs::isSMTPServer(IpAddress *ip, u_int16_t vlan_id) {
return smtp_servers->findAddress(ip, vlan_id);
}
}

0 comments on commit 290e986

Please sign in to comment.