On Wed Mar 06 19:18:55 2013, JPEACOCK wrote:
Show quoted text> On Tue Nov 20 02:23:37 2012, SPROUT wrote:
> > The ‘Integer overflow in version’ warning from scan_version causes a
> > memory leak if fatal
> > warnings are enabled.
> >
> > Run this ‘one’-liner and watch the memory usage:
> >
> > $ ./perl -Ilib -Mwarnings=FATAL,all -e 'warn $$; while (1) { new
> > version
> > "v111111111111111111111111111111" }'
>
> Having a hard time with this one. Still looking at it...
Something like
ENTER;
...
SAVEFREEPV(some string that needs to be freed);
...
SAVEFREESV(some scalar that needs to be freed);
...
LEAVE;
should do the trick. I haven’t looked at the code too closely.
If you need to countermand a SAVEFREESV, you can simply SvREFCNT_inc.
If you need to countermand a SAVEFREEPV, it is a little trickier and requires an SV wrapper;
SV *wrapper = newSV_type(SVt_PV);
SvPV_set(wrapper, that_pv);
SvLEN_set(wrapper, 1); /* any non-zero will do */
SAVEFREESV(wrapper);
Countermand it with SvLEN_set(wrapper,0);