From ef52f26769230093cf0cbb76485a7951d4ebb21a Mon Sep 17 00:00:00 2001 From: david Date: Mon, 7 Sep 2009 22:00:42 +0000 Subject: [PATCH] Don't delete each target after doing a ping-scan traceroute; a future implementation will have records for one target refer to others. Delete them all at once at the end instead as is done with other scan types. --- nmap.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nmap.cc b/nmap.cc index 4cac84af2..2c6cef558 100644 --- a/nmap.cc +++ b/nmap.cc @@ -1810,14 +1810,15 @@ int nmap_main(int argc, char *argv[]) { /* ping scan traceroutes */ if(o.traceroute && o.noportscan) { /* Assume that all targets in a group use the same device */ + vector::iterator it; troute = new Traceroute(Targets[0]->deviceName(), Targets[0]->ifType(), &ports); troute->trace(Targets); troute->resolveHops(); /* print ping traceroutes, making sure the reference * trace is first */ - while(!Targets.empty()) { - currenths = *Targets.begin(); + for (it = Targets.begin(); it != Targets.end(); it++) { + currenths = *it; o.numhosts_scanned++; log_write(LOG_XML, ""); write_host_status(currenths, o.resolve_all); @@ -1825,8 +1826,11 @@ int nmap_main(int argc, char *argv[]) { troute->outputTarget(currenths); log_write(LOG_XML, "\n"); log_write(LOG_PLAIN,"\n"); + } + while(!Targets.empty()) { + currenths = Targets.back(); delete currenths; - Targets.erase(Targets.begin()); + Targets.pop_back(); } o.numhosts_scanning = 0; log_flush_all();