--- nmap.cc.orig 2012-11-11 14:29:17.768998606 -0800 +++ nmap.cc 2012-11-21 14:48:07.069997940 -0800 @@ -2257,7 +2257,19 @@ /* 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); + error("value of 'errno' is: %s \n", strerror(errno)); + } + return 0; }