From: Joshua Blanton (jblanton@masaka.cs.ohiou.edu)
Date: 01/04/06
Date: Wed, 4 Jan 2006 14:58:21 -0500 From: Joshua Blanton <jblanton@masaka.cs.ohiou.edu> Subject: Re: tcptrace-bugs Static variable returns of HostName() are not consider by callers Message-ID: <20060104195821.GA15431@mauser.ipx.ath.cx>
Shawn Ostermann wrote:
> We should talk about this first. The extra overhead of the strdup()
> plus the free() after the printf() will be expensive. And, of
> course, somebody will forget to use free, or will have a custom bit
> of code that doesn't use it, which will lead to a terrible memory
> leak that will be very difficult to find.
Hm, it seems to me that the suggested fix is sufficient... In the
case of printf() (and any other function that would potentially
re-use the pointer more than once in an instance) we need to do some
clean-up - but in the case of printf(), the cleanup is trivial.
Just split the line printed into multiple lines and it All Gets
Better. Existing code is already safe from this bug, other than
debug messages, so why not just fix the debug messages?
--jtb
This archive was generated by hypermail 2.1.7 : 01/05/06 EST