1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-15 02:49:02 +00:00

updating --release-memory (thus far) and freeing some other areas early on

This commit is contained in:
kris
2008-06-08 05:29:00 +00:00
parent 798438e2d2
commit 0632f1f8da
3 changed files with 19 additions and 8 deletions

View File

@@ -459,7 +459,7 @@ void NmapOps::ValidateOptions() {
/* Make sure nmap.registry.args is available (even if it's empty) */
if (!scriptargs)
scriptargs = "";
scriptargs = strdup("");
}
void NmapOps::setMaxOSTries(int mot) {

View File

@@ -319,7 +319,7 @@ class NmapOps {
#ifndef NOLUA
int script;
const char *scriptargs;
char *scriptargs;
int scriptversion;
int scripttrace;
int scriptupdatedb;

23
nmap.cc
View File

@@ -1046,7 +1046,7 @@ int nmap_main(int argc, char *argv[]) {
}
break;
case 'm':
machinefilename = optarg;
machinefilename = logfilename(optarg, tm);
break;
case 'n': o.noresolve++; break;
case 'O':
@@ -1284,14 +1284,22 @@ int nmap_main(int argc, char *argv[]) {
/* Open the log files, now that we know whether the user wants them appended
or overwritten */
if (normalfilename)
if (normalfilename) {
log_open(LOG_NORMAL, o.append_output, normalfilename);
if (machinefilename)
free(normalfilename);
}
if (machinefilename) {
log_open(LOG_MACHINE, o.append_output, machinefilename);
if (kiddiefilename)
free(machinefilename);
}
if (kiddiefilename) {
log_open(LOG_SKID, o.append_output, kiddiefilename);
if (xmlfilename)
free(kiddiefilename);
}
if (xmlfilename) {
log_open(LOG_XML, o.append_output, xmlfilename);
free(xmlfilename);
}
if (!o.interactivemode) {
char tbuf[128];
@@ -1888,7 +1896,10 @@ void nmap_free_mem() {
o.reference_FPs = NULL;
}
AllProbes::service_scan_free();
if (o.dns_servers) free(o.dns_servers);
if (o.extra_payload) free(o.extra_payload);
if (o.ipoptions) free(o.ipoptions);
free(o.scriptargs);
}
/* Reads in a (normal or machine format) Nmap log file and gathers enough