diff options
author | David Mitchell <davem@iabyn.com> | 2015-05-17 19:38:44 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2015-05-18 22:04:40 +0100 |
commit | bae466e878e8602a507f96eab3bac37f2066b4fb (patch) | |
tree | 46e317836c25430888fb2c1ab26c7d71c5c05973 /lib/ExtUtils | |
parent | 33ca8d3cbd5926d9f199307cc0f5652557026908 (diff) | |
download | perl-bae466e878e8602a507f96eab3bac37f2066b4fb.tar.gz |
Revert "stop T_IN/OUT/INOUT/STDIO typemaps leaking"
This reverts commit 50e5165b9638b94be310f15477b42935c79e82d5.
That commit fixed the leak too well and instead introduced a potential
premature free.
This re-introduces the long-standing leak, which will be addressed post
5.22 release.
See RT #124181
Diffstat (limited to 'lib/ExtUtils')
-rw-r--r-- | lib/ExtUtils/typemap | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/lib/ExtUtils/typemap b/lib/ExtUtils/typemap index 831baad26c..0b09641f8d 100644 --- a/lib/ExtUtils/typemap +++ b/lib/ExtUtils/typemap @@ -388,48 +388,32 @@ T_STDIO { GV *gv = newGVgen("$Package"); PerlIO *fp = PerlIO_importFILE($var,0); - if ( fp && do_open(gv, "+<&", 3, FALSE, 0, 0, fp) ) { - SV *rv = newRV_noinc((SV*)gv); - rv = sv_bless(rv, gv_stashpv("$Package",1)); - sv_setsv($arg, rv); - SvREFCNT_dec_NN(rv); - } + if ( fp && do_open(gv, "+<&", 3, FALSE, 0, 0, fp) ) + sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1))); else $arg = &PL_sv_undef; } T_IN { GV *gv = newGVgen("$Package"); - if ( do_open(gv, "<&", 2, FALSE, 0, 0, $var) ) { - SV *rv = newRV_noinc((SV*)gv); - rv = sv_bless(rv, gv_stashpv("$Package",1)); - sv_setsv($arg, rv); - SvREFCNT_dec_NN(rv); - } + if ( do_open(gv, "<&", 2, FALSE, 0, 0, $var) ) + sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1))); else $arg = &PL_sv_undef; } T_INOUT { GV *gv = newGVgen("$Package"); - if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) ) { - SV *rv = newRV_noinc((SV*)gv); - rv = sv_bless(rv, gv_stashpv("$Package",1)); - sv_setsv($arg, rv); - SvREFCNT_dec_NN(rv); - } + if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) ) + sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1))); else $arg = &PL_sv_undef; } T_OUT { GV *gv = newGVgen("$Package"); - if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) ) { - SV *rv = newRV_noinc((SV*)gv); - rv = sv_bless(rv, gv_stashpv("$Package",1)); - sv_setsv($arg, rv); - SvREFCNT_dec_NN(rv); - } + if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) ) + sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1))); else $arg = &PL_sv_undef; } |