From: Bo Lindbergh Date: Fri, 5 Jan 2007 19:19:53 +0000 (+0100) Subject: ext/PerlIO/via/via.xs freeing the wrong thing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3904eff97a530f1d0640005c46e474f7f62fee5b;p=p5sagit%2Fp5-mst-13.2.git ext/PerlIO/via/via.xs freeing the wrong thing Message-Id: p4raw-id: //depot/perl@29701 --- diff --git a/ext/PerlIO/via/via.xs b/ext/PerlIO/via/via.xs index 733ffd6..36e739a 100644 --- a/ext/PerlIO/via/via.xs +++ b/ext/PerlIO/via/via.xs @@ -137,10 +137,10 @@ PerlIOVia_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg, s->obj = SvREFCNT_inc(arg); s->stash = gv_stashpvn(pkg, pkglen, FALSE); if (!s->stash) { + SvREFCNT_dec(s->obj); s->obj = newSVpvn(Perl_form(aTHX_ "PerlIO::via::%s", pkg), pkglen + 13); - SvREFCNT_dec(arg); s->stash = gv_stashpvn(SvPVX_const(s->obj), pkglen + 13, FALSE); } if (s->stash) { @@ -156,8 +156,8 @@ PerlIOVia_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg, modesv, Nullsv); if (result) { if (sv_isobject(result)) { + SvREFCNT_dec(s->obj); s->obj = SvREFCNT_inc(result); - SvREFCNT_dec(arg); } else if (SvIV(result) != 0) return SvIV(result);