1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Avoid duplicating udp payloads in memory

Storing a pointer instead of the whole struct payload enables us to
reuse the same struct for as many ports as the payload defines, saving
memory as well as the time to copy the struct and its std::string
member. This commit also avoids several copy constructions and deletions
of the payload vector for each port defined in the file.
This commit is contained in:
dmiller
2021-12-12 23:42:38 +00:00
parent 2cea59aca0
commit 2cbc7712da
3 changed files with 31 additions and 27 deletions

View File

@@ -90,6 +90,7 @@
#include "utils.h"
#include "xml.h"
#include "scan_lists.h"
#include "payload.h"
#ifndef NOLUA
#include "nse_main.h"
@@ -1789,6 +1790,7 @@ void nmap_free_mem() {
cp_free();
free_services();
freeinterfaces();
free_payloads();
AllProbes::service_scan_free();
traceroute_hop_cache_clear();
nsock_set_default_engine(NULL);