Change 33212 by [EMAIL PROTECTED] on 2008/02/02 21:10:57

        Integrate:
        [ 33138]
        Integrate:
        [ 32816]
        Fix memory leaks in XS_PerlIO_get_layers() by mortalizing
        all variables pushed on the stack. Also make sure the loop
        is using mXPUSHi() and not XPUSHi().
        
        [ 32817]
        Forgot to remove dTARGET with change #32816.

Affected files ...

... //depot/maint-5.8/perl/universal.c#69 integrate

Differences ...

==== //depot/maint-5.8/perl/universal.c#69 (text) ====
Index: perl/universal.c
--- perl/universal.c#68~32343~  2007-11-16 12:32:46.000000000 -0800
+++ perl/universal.c    2008-02-02 13:10:57.000000000 -0800
@@ -625,7 +625,6 @@
        }
 
        if (gv && (io = GvIO(gv))) {
-            dTARGET;
             AV* const av = PerlIO_get_layers(aTHX_ input ?
                                        IoIFP(io) : IoOFP(io));
             I32 i;
@@ -643,25 +642,25 @@
 
                  if (details) {
                       XPUSHs(namok
-                             ? newSVpvn(SvPVX_const(*namsvp), SvCUR(*namsvp))
+                             ? sv_2mortal(newSVpvn(SvPVX_const(*namsvp), 
SvCUR(*namsvp)))
                              : &PL_sv_undef);
                       XPUSHs(argok
-                             ? newSVpvn(SvPVX_const(*argsvp), SvCUR(*argsvp))
+                             ? sv_2mortal(newSVpvn(SvPVX_const(*argsvp), 
SvCUR(*argsvp)))
                              : &PL_sv_undef);
                       if (flgok)
-                           XPUSHi(SvIVX(*flgsvp));
+                           mXPUSHi(SvIVX(*flgsvp));
                       else
                            XPUSHs(&PL_sv_undef);
                       nitem += 3;
                  }
                  else {
                       if (namok && argok)
-                           XPUSHs(Perl_newSVpvf(aTHX_ "%"SVf"(%"SVf")",
+                           XPUSHs(sv_2mortal(Perl_newSVpvf(aTHX_ 
"%"SVf"(%"SVf")",
                                                 (void*)*namsvp,
-                                                (void*)*argsvp));
+                                                (void*)*argsvp)));
                       else if (namok)
-                           XPUSHs(Perl_newSVpvf(aTHX_ "%"SVf,
-                                                (void*)*namsvp));
+                           XPUSHs(sv_2mortal(Perl_newSVpvf(aTHX_ "%"SVf,
+                                                (void*)*namsvp)));
                       else
                            XPUSHs(&PL_sv_undef);
                       nitem++;
@@ -669,7 +668,7 @@
                            const IV flags = SvIVX(*flgsvp);
 
                            if (flags & PERLIO_F_UTF8) {
-                                XPUSHs(newSVpvs("utf8"));
+                                XPUSHs(sv_2mortal(newSVpvs("utf8")));
                                 nitem++;
                            }
                       }
End of Patch.

Reply via email to