--- nmap.cc.orig 2012-11-11 14:29:17.768998606 -0800 +++ nmap.cc 2012-11-11 14:33:34.357999981 -0800 @@ -2257,7 +2257,17 @@ /* Ensure the log file ends with a newline */ filestr[filelen - 1] = '\n'; - munmap(filestr, filelen); + + /* + * we cannot recover from a munmap() failure, but + * we can print out an informative message with + * the address location and size of the memory + * mapping which wasn't released by munmap(). + */ + + if (munmap(filestr, filelen) != 0) + error("Warning: unable to unmap memory at address %p and size %u.\n", filestr, filelen); + return 0; }