summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-11-02 06:12:27 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-11-02 06:12:27 -0700
commit104c40b089b35a27c011188bbe19b03f1150c54c (patch)
tree68c51b091d3b90d41e1b4c5285c3703500de6860 /pp_sys.c
parent4a608acc6005c3f6abb2284d7bf50732d400aa71 (diff)
downloadperl-104c40b089b35a27c011188bbe19b03f1150c54c.tar.gz
Don’t leak when printfing to bad handle under fatal warnings
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index bb82e32122..82de0dd56b 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1515,7 +1515,7 @@ PP(pp_prtf)
{
dVAR; dSP; dMARK; dORIGMARK;
PerlIO *fp;
- SV *sv;
+ SV *sv = NULL;
GV * const gv
= (PL_op->op_flags & OPf_STACKED) ? MUTABLE_GV(*++MARK) : PL_defoutgv;
@@ -1540,7 +1540,6 @@ PP(pp_prtf)
}
}
- sv = newSV(0);
if (!io) {
report_evil_fh(gv);
SETERRNO(EBADF,RMS_IFI);
@@ -1555,6 +1554,7 @@ PP(pp_prtf)
goto just_say_no;
}
else {
+ sv = newSV(0);
do_sprintf(sv, SP - MARK, MARK + 1);
if (!do_print(sv, fp))
goto just_say_no;