On Wed, Aug 08, 2007 at 12:17:17AM -0700, chromatic wrote:
> The string_from_cstring() function has a slight flaw, in that it has to 
> allocate a piece of memory and create a C-style string from a nice happy 
> STRING.  It's the responsibility of the caller to discard the C string 
> appropriately.
> 
> This is tricky if that string immediately gets passed to real_exception() or 
> some other C function which does not return control; there's no chance to 
> free the string with string_cstring_free().

I hate to sound like the nag here but why don't we just not write code
in form 'real_exception(string_from_cstring(foo))'.  Part of living with
dynamic memory allocating is dealing with the line bloat of shoving that
free() call in there. 

-J

--

Attachment: pgpXlMyPl0RLm.pgp
Description: PGP signature

Reply via email to