From: Nicholas Clark Date: Sat, 15 Apr 2006 20:01:58 +0000 (+0000) Subject: Fix a bug - the introduction of the caching code means that we should X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ec0b63d7653607317b5427af153e4a7e13388bee;p=p5sagit%2Fp5-mst-13.2.git Fix a bug - the introduction of the caching code means that we should initialise the SV upstream after it. assert that filter_sub is always non-null now. p4raw-id: //depot/perl@27820 --- diff --git a/pp_ctl.c b/pp_ctl.c index 1a0245a..d7d3fda 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -4524,14 +4524,11 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) then clearly what it contains is already filtered by this filter, so we don't want to pass it in a second time. I'm going to use a mortal in case the upstream filter croaks. */ - SV *const upstream - = ((SvOK(buf_sv) && sv_len(buf_sv)) || SvGMAGICAL(buf_sv)) - ? sv_newmortal() : buf_sv; + SV *upstream; STRLEN got_len; const char *got_p; const char *prune_from = NULL; - SvUPGRADE(upstream, SVt_PV); /* I was having segfault trouble under Linux 2.2.5 after a parse error occured. (Had to hack around it with a test for PL_error_count == 0.) Solaris doesn't segfault -- @@ -4572,12 +4569,17 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) SvOK_off(cache); } } + + upstream = ((SvOK(buf_sv) && sv_len(buf_sv)) || SvGMAGICAL(buf_sv)) + ? sv_newmortal() : buf_sv; + SvUPGRADE(upstream, SVt_PV); if (filter_has_file) { status = FILTER_READ(idx+1, upstream, maxlen); } - if (filter_sub && status >= 0) { + assert(filter_sub); + if (status >= 0) { dSP; int count;