diff --git a/CHANGELOG b/CHANGELOG
index 2ae39fee9..b2ba75988 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
#Nmap Changelog ($Id$); -*-text-*-
+o The --release-memory option is now a no-op. Nmap will always run finalization
+ routines that release allocated memory before closing.
+
o Fixed an integer underflow in service_scan.cc that would cause little-endian
integers extracted from the beginning of a service banner to be interpreted
as 0. Discovered with AFL++ by Malek Althubiany.
diff --git a/NmapOps.cc b/NmapOps.cc
index 13a6f3bae..ca543efc0 100644
--- a/NmapOps.cc
+++ b/NmapOps.cc
@@ -315,7 +315,6 @@ void NmapOps::Initialize() {
ipoptionslen = 0;
ipopt_firsthop = 0;
ipopt_lasthop = 0;
- release_memory = false;
topportlevel = -1;
#ifndef NOLUA
script = false;
diff --git a/NmapOps.h b/NmapOps.h
index b9ba18198..cecf420da 100644
--- a/NmapOps.h
+++ b/NmapOps.h
@@ -339,7 +339,6 @@ class NmapOps {
bool noninteractive;
char *locale;
- bool release_memory; /* suggest to release memory before quitting. used to find memory leaks. */
private:
int max_os_tries;
int max_rtt_timeout;
diff --git a/docs/man-xlate/nmap-man-de.xml b/docs/man-xlate/nmap-man-de.xml
index 1365bf5f2..5069765d8 100644
--- a/docs/man-xlate/nmap-man-de.xml
+++ b/docs/man-xlate/nmap-man-de.xml
@@ -4075,21 +4075,6 @@ gesetzt werden.
-
-
- (gibt Speicher vor Terminierung frei)
-
-
-
-
-Diese Option ist nur bei der Suche nach Speicherlecks nützlich.
-Sie bewirkt, dass Nmap den von ihm belegten Speicher direkt vor seiner
-Terminierung freigibt, damit man echte Speicherlecks einfacher finden kann.
-Normalerweise macht Nmap das nicht, weil es das Betriebssystem ohnehin
-macht, wenn es den Prozess terminiert.
-
-
-
; (gibt Versionsnummer aus)
diff --git a/docs/man-xlate/nmap-man-fr.xml b/docs/man-xlate/nmap-man-fr.xml
index 704ae9f29..ee7af85d0 100644
--- a/docs/man-xlate/nmap-man-fr.xml
+++ b/docs/man-xlate/nmap-man-fr.xml
@@ -2112,18 +2112,6 @@ le temps supplémentaire que cela suppose.
.
-
-
- (Libérer la mémoire avant de quitter)
-
-
- Cette option n'est utile que dans le cadre du deboggage de fuites de mémoire.
- Elle force Nmap a libérer la mémoire allouée juste avant de
- quitter de facon a repérer les véritables fuites de mémoire.
- En temps normal Nmap ne fait pas ceci étant donné que l'OS le fait de toutes facons
- à la fin du processus.
-
-
; (Affiche le numéro de version)
diff --git a/docs/man-xlate/nmap-man-hu.xml b/docs/man-xlate/nmap-man-hu.xml
index 3966a7d76..e3a98da69 100644
--- a/docs/man-xlate/nmap-man-hu.xml
+++ b/docs/man-xlate/nmap-man-hu.xml
@@ -3459,22 +3459,6 @@ kapuk csak egy számként jelennek meg, ha túl sok van belőlük.
-
-
- (Kilépés előtt felszabadítja a memóriát)
- --release-memory
-
-
-
- Ez a paraméter csak a memóriaszivárgási hibák keresésekor hasznos.
- Arra utasítja az Nmap programot, hogy a kilépés előtt szabadítsa fel a
- lefoglalt memóriát, így a memóriaszivárgás könnyen felderíthető. Normál
- helyzetben az Nmap átugorja ezt, mivel a program leállításakor az operációs
- rendszert ezt amúgy is végrehajtja.
-
-
-
-
; (Programváltozat megjelenítése)
diff --git a/docs/man-xlate/nmap-man-id.xml b/docs/man-xlate/nmap-man-id.xml
index faa9a3c7a..01043b605 100644
--- a/docs/man-xlate/nmap-man-id.xml
+++ b/docs/man-xlate/nmap-man-id.xml
@@ -3755,22 +3755,6 @@ banyaknya permintaan. Berikan untuk hanya melihat port
-
-
- (Release memory before quitting)
-
-
-
-
- Opsi ini hanya berguna untuk memory-leak debugging.
- Ia membuat Nmap merilis memori yang telah dialokasikan sebelum ia berhenti
- sehingga kebocoran memori sebenarnya mudah ditemukan.
- Normalnya Nmap melewati langkah ini karena SO melakukannya setelah
- penghentian proses.
-
-
-
-
; (Print version number)
diff --git a/docs/man-xlate/nmap-man-it.xml b/docs/man-xlate/nmap-man-it.xml
index 894203ecf..a09b11f56 100644
--- a/docs/man-xlate/nmap-man-it.xml
+++ b/docs/man-xlate/nmap-man-it.xml
@@ -4343,20 +4343,6 @@ SEE THE MAN PAGE (https://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES
-
- (Release memory before
- quitting)
-
-
- Quest'opzione è utile solo per la risoluzione di problemi di
- perdita di memoria (memory-leak debugging). Obbliga infatti ad Nmap
- a liberare la memoria allocata appena prima di uscire così da
- individuare più facilmente le effettive perdite di memoria. Di
- solito Nmap salta questo passaggio come fa il sistema operativo in
- ogni caso al momento della chiusura del processo.
-
-
-
; (Print version
number)
diff --git a/docs/man-xlate/nmap-man-ja.xml b/docs/man-xlate/nmap-man-ja.xml
index 2d45dac48..394631da3 100644
--- a/docs/man-xlate/nmap-man-ja.xml
+++ b/docs/man-xlate/nmap-man-ja.xml
@@ -1362,7 +1362,7 @@ rttvar: 14987 to: 100000。こうした行の内容が理解で
-
+
; (バージョン番号を表示する)
diff --git a/docs/man-xlate/nmap-man-pt_BR.xml b/docs/man-xlate/nmap-man-pt_BR.xml
index b0cbffbae..86bf17981 100644
--- a/docs/man-xlate/nmap-man-pt_BR.xml
+++ b/docs/man-xlate/nmap-man-pt_BR.xml
@@ -3554,24 +3554,6 @@ EXAMPLES:
-
- (Release memory before
- quitting)
-
-
-
- --release-memory
-
-
- Esta opção é útil apenas para depuração de vazamentos de
- memória (memory-leak). Ela faz com que o Nmap libere memória
- alocada pouco antes de encerrar de forma a tornar os vazamentos de
- memória reais mais fáceis de se ver. Normalmente o Nmap pula essa
- parte pois o SO faz isso de qualquer forma no encerramento de um
- processo.
-
-
-
; (Mostra o
número da versão)
diff --git a/docs/man-xlate/nmap-man-ru.xml b/docs/man-xlate/nmap-man-ru.xml
index 7ab0cedd1..835ec4e54 100644
--- a/docs/man-xlate/nmap-man-ru.xml
+++ b/docs/man-xlate/nmap-man-ru.xml
@@ -3295,20 +3295,6 @@ rttvar: 14987 to: 100000. Если вы не понимаете
-
-
- (Освободить память перед завершением работы)
-
-
-
-
- Эта опция полезна только во время отладки утечки памяти. Заставляет Nmap освободить занянутю память
- перед завершением работы, что облегчает задачу обнаружения действительной утечки памяти. В обычном режиме
- работы Nmap пропускает этот шаг, так ОС делает это самостоятельно при закрытии процесса.
-
-
-
-
; (Вывести номер версии)
diff --git a/docs/refguide.xml b/docs/refguide.xml
index 5a664627b..435021026 100644
--- a/docs/refguide.xml
+++ b/docs/refguide.xml
@@ -4488,22 +4488,6 @@ hosts with at least one
-
-
- (Release memory before quitting)
-
-
-
-
- This option is only useful for memory-leak debugging.
- It causes Nmap to release allocated memory just before it
- quits so that actual memory leaks are easier to spot.
- Normally Nmap skips this as the OS does this anyway upon
- process termination.
-
-
-
-
; (Print version number)
diff --git a/nmap.cc b/nmap.cc
index fb238c8e3..2556d966c 100644
--- a/nmap.cc
+++ b/nmap.cc
@@ -728,7 +728,7 @@ void parse_options(int argc, char **argv) {
} else if (strcmp(long_options[option_index].name, "nogcc") == 0) {
o.nogcc = true;
} else if (strcmp(long_options[option_index].name, "release-memory") == 0) {
- o.release_memory = true;
+ /* No-op. We always release memory now. */
} else if (strcmp(long_options[option_index].name, "min-parallelism") == 0) {
o.min_parallelism = atoi(optarg);
if (o.min_parallelism < 1)
@@ -2371,9 +2371,7 @@ int nmap_main(int argc, char *argv[]) {
eth_close_cached();
- if (o.release_memory) {
- nmap_free_mem();
- }
+ nmap_free_mem();
if (o.resuming) {
arg_parse_free(argv);
}