summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorArtur Bergman <sky@nanisky.com>2003-04-21 21:33:14 +0000
committerArtur Bergman <sky@nanisky.com>2003-04-21 21:33:14 +0000
commit5a37521b37ed04c9015dfb877d1278e19147f5d3 (patch)
tree8bdb725356f4ddc1b4aa9b83b00ab1d0989cd2d6 /sv.c
parent7b102d90616d2574b3c6a3d1942fcb59fc2aaefb (diff)
downloadperl-5a37521b37ed04c9015dfb877d1278e19147f5d3.tar.gz
Fix bug 17964 by properly refcounting the gv top.
Seems like the entries in rsfp are way different than normal PVIO objects. p4raw-id: //depot/perl@19301
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sv.c b/sv.c
index 45638099d4..a0c11a9e12 100644
--- a/sv.c
+++ b/sv.c
@@ -10072,12 +10072,21 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param)
IoPAGE(dstr) = IoPAGE(sstr);
IoPAGE_LEN(dstr) = IoPAGE_LEN(sstr);
IoLINES_LEFT(dstr) = IoLINES_LEFT(sstr);
+ if(IoFLAGS(sstr) & IOf_FAKE_DIRP) {
+ /* I have no idea why fake dirp (rsfps)
+ should be treaded differently but otherwise
+ we end up with leaks -- sky*/
+ IoTOP_GV(dstr) = gv_dup_inc(IoTOP_GV(sstr), param);
+ IoFMT_GV(dstr) = gv_dup_inc(IoFMT_GV(sstr), param);
+ IoBOTTOM_GV(dstr) = gv_dup_inc(IoBOTTOM_GV(sstr), param);
+ } else {
+ IoTOP_GV(dstr) = gv_dup(IoTOP_GV(sstr), param);
+ IoFMT_GV(dstr) = gv_dup(IoFMT_GV(sstr), param);
+ IoBOTTOM_GV(dstr) = gv_dup(IoBOTTOM_GV(sstr), param);
+ }
IoTOP_NAME(dstr) = SAVEPV(IoTOP_NAME(sstr));
- IoTOP_GV(dstr) = gv_dup(IoTOP_GV(sstr), param);
IoFMT_NAME(dstr) = SAVEPV(IoFMT_NAME(sstr));
- IoFMT_GV(dstr) = gv_dup(IoFMT_GV(sstr), param);
IoBOTTOM_NAME(dstr) = SAVEPV(IoBOTTOM_NAME(sstr));
- IoBOTTOM_GV(dstr) = gv_dup(IoBOTTOM_GV(sstr), param);
IoSUBPROCESS(dstr) = IoSUBPROCESS(sstr);
IoTYPE(dstr) = IoTYPE(sstr);
IoFLAGS(dstr) = IoFLAGS(sstr);