[svn:parrot] r31812 - trunk/src

chromatic chromatic at wgz.org
Sat Oct 11 16:24:59 UTC 2008


On Saturday 11 October 2008 02:55:08 Allison Randal wrote:

> chromatic at cvs.perl.org wrote:

> > Modified:
> >    trunk/src/inter_call.c
> >
> > Log:
> > [src] Fixed a memory leak in Parrot_pcc_invoke_sub_from_sig_object(),
> > where nothing freed a C string created from the signature object.  I'm
> > not completely convinced that this is correct, but Valgrind is happier
> > now.
> >
> > Modified: trunk/src/inter_call.c
> > =========================================================================
> >===== --- trunk/src/inter_call.c	(original)
> > +++ trunk/src/inter_call.c	Wed Oct  8 20:55:25 2008
>
> [...]
>
> >      interp->current_args   = save_current_args;
> >      interp->args_signature = save_args_signature;
> >      interp->current_object = save_current_object;
> > +    string_cstring_free(signature);
> >  }
>
> This change is the cause of this warning in gcc:
>
> src/inter_call.c: In function ‘Parrot_pcc_invoke_sub_from_sig_object’:
> src/inter_call.c:2665: warning: passing argument 1 of
> ‘string_cstring_free’ discards qualifiers from pointer target type
>
> So, not the right fix.

That warning is mostly irrelevant in this case.  It means that signature is a 
const char * in the caller but the callee expects a char *.  I think NotFound 
already removed the const to satisfy C++ compilers anyway.

(Though the point that having to free these explicitly is a pain is true.)

-- c


More information about the parrot-dev mailing list