Nmap Development mailing list archives

Re: Memory management strategies in Nmap?


From: Fyodor <fyodor () nmap org>
Date: Sun, 1 Dec 2013 23:40:40 -0800

On Tue, Nov 26, 2013 at 12:27 PM, Daniel Miller <bonsaiviking () gmail com>wrote:

Fellow devs,

I've nearly tracked down all the "bugs" that Clang's AddressSanitizer[1]
has shown in Nmap, but the fix to this last one has raised a question
regarding memory management. I'm confident of this fix, but I would like to
know more on the history of the various safe_*alloc functions, and why they
might be preferable to C++ operator new.


Hi Daniel.  Good catch and thanks for investigating these Clang results.
 The safe_*alloc functions are from Nmap's original C code before we could
use new and delete.  But I wrote the FingerPrintResultsIPv4[] code
mentioned here back in 2006 when adding the --max-os-tries option (-r4026).
 That's ancient, but still well after Nmap's C++ conversion.  I think
new/delete is better here and so your patch would be an improvement.

Cheers,
Fyodor
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: