{
dVAR; dSP; dMARK; dORIGMARK;
PerlIO *fp;
- SV *sv = NULL;
GV * const gv
= (PL_op->op_flags & OPf_STACKED) ? MUTABLE_GV(*++MARK) : PL_defoutgv;
goto just_say_no;
}
else {
- sv = newSV(0);
+ SV *sv = sv_newmortal();
do_sprintf(sv, SP - MARK, MARK + 1);
if (!do_print(sv, fp))
goto just_say_no;
if (PerlIO_flush(fp) == EOF)
goto just_say_no;
}
- SvREFCNT_dec(sv);
SP = ORIGMARK;
PUSHs(&PL_sv_yes);
RETURN;
just_say_no:
- SvREFCNT_dec(sv);
SP = ORIGMARK;
PUSHs(&PL_sv_undef);
RETURN;
use Config;
-plan tests => 44;
+plan tests => 45;
# run some code N times. If the number of SVs at the end of loop N is
# greater than (N-1)*delta at the end of loop 1, we've got a leak
leak(2, 0, sub {
eval { printf uNopened 42 };
}, 'printfing to bad handle under fatal warnings does not leak');
-
+ open my $fh, ">", \my $buf;
+ leak(2, 0, sub {
+ eval { printf $fh chr 2455 };
+ }, 'wide fatal warning does not make printf leak');
+ close $fh or die $!;
}