On Friday 09 November 2007 09:00:00 [EMAIL PROTECTED] wrote:

> Author: paultcochrane
> Date: Fri Nov  9 08:59:59 2007
> New Revision: 22780
>
> Modified:
>    trunk/src/objects.c
>    trunk/src/pmc/namespace.pmc
>    trunk/src/pmc_freeze.c
>
> Log:
> [core,pmc] Removed unreachable code compiler warnings
>
> Modified: trunk/src/objects.c
> ===========================================================================
>=== --- trunk/src/objects.c    (original)
> +++ trunk/src/objects.c       Fri Nov  9 08:59:59 2007
> @@ -1918,10 +1918,8 @@
>
>      /* RT#45989 escape NUL char */
>      if (VTABLE_exists_keyed_str(interp, attr_hash, full_attr_name)) {
> -        char * const c_error = string_to_cstring(interp, full_attr_name);
> -        real_exception(interp, NULL, 1, "Attribute '%s' already exists",
> c_error); -        /* RT#45991 leak! */
> -        string_cstring_free(c_error);
> +        real_exception(interp, NULL, 1, "Attribute '%s' already exists",
> +                string_to_cstring(interp, full_attr_name));
>      }

I'm not a huge fan of this, especially when removing the RT #45591 link, but a 
better solution is to use the format %Ss, which tells Parrot's sprintf engine 
that it's getting a STRING.  This avoids the memory leak of 
string_to_cstring().

-- c

Reply via email to