summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-05-30 03:24:03 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-05-30 03:24:03 +0000
commitea2f84a302630d2e72764455e0be657ac02fbb9c (patch)
tree0d126269059a50e44b6efce900b6276d89f09c7b /op.c
parenta1ae71d2eab6bef8ae541232f19e7e981e18b3c6 (diff)
downloadperl-ea2f84a302630d2e72764455e0be657ac02fbb9c.tar.gz
fix memory leak in C<eval "BEGIN {}"> (bug in change#4579)
p4raw-link: @4579 on //depot/perl: ed094fafab5cc8979a919ec8755493543b6bddf5 p4raw-id: //depot/perl@6163
Diffstat (limited to 'op.c')
-rw-r--r--op.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/op.c b/op.c
index 18132320f9..c7da1c58eb 100644
--- a/op.c
+++ b/op.c
@@ -4649,8 +4649,8 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
if (!PL_beginav)
PL_beginav = newAV();
DEBUG_x( dump_sub(gv) );
- av_push(PL_beginav, SvREFCNT_inc(cv));
- GvCV(gv) = 0;
+ av_push(PL_beginav, (SV*)cv);
+ GvCV(gv) = 0; /* cv has been hijacked */
call_list(oldscope, PL_beginav);
PL_curcop = &PL_compiling;
@@ -4662,8 +4662,8 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
PL_endav = newAV();
DEBUG_x( dump_sub(gv) );
av_unshift(PL_endav, 1);
- av_store(PL_endav, 0, SvREFCNT_inc(cv));
- GvCV(gv) = 0;
+ av_store(PL_endav, 0, (SV*)cv);
+ GvCV(gv) = 0; /* cv has been hijacked */
}
else if (strEQ(s, "CHECK") && !PL_error_count) {
if (!PL_checkav)
@@ -4672,8 +4672,8 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
if (PL_main_start && ckWARN(WARN_VOID))
Perl_warner(aTHX_ WARN_VOID, "Too late to run CHECK block");
av_unshift(PL_checkav, 1);
- av_store(PL_checkav, 0, SvREFCNT_inc(cv));
- GvCV(gv) = 0;
+ av_store(PL_checkav, 0, (SV*)cv);
+ GvCV(gv) = 0; /* cv has been hijacked */
}
else if (strEQ(s, "INIT") && !PL_error_count) {
if (!PL_initav)
@@ -4681,8 +4681,8 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
DEBUG_x( dump_sub(gv) );
if (PL_main_start && ckWARN(WARN_VOID))
Perl_warner(aTHX_ WARN_VOID, "Too late to run INIT block");
- av_push(PL_initav, SvREFCNT_inc(cv));
- GvCV(gv) = 0;
+ av_push(PL_initav, (SV*)cv);
+ GvCV(gv) = 0; /* cv has been hijacked */
}
}
@@ -4808,15 +4808,15 @@ Perl_newXS(pTHX_ char *name, XSUBADDR_t subaddr, char *filename)
if (strEQ(s, "BEGIN")) {
if (!PL_beginav)
PL_beginav = newAV();
- av_push(PL_beginav, SvREFCNT_inc(cv));
- GvCV(gv) = 0;
+ av_push(PL_beginav, (SV*)cv);
+ GvCV(gv) = 0; /* cv has been hijacked */
}
else if (strEQ(s, "END")) {
if (!PL_endav)
PL_endav = newAV();
av_unshift(PL_endav, 1);
- av_store(PL_endav, 0, SvREFCNT_inc(cv));
- GvCV(gv) = 0;
+ av_store(PL_endav, 0, (SV*)cv);
+ GvCV(gv) = 0; /* cv has been hijacked */
}
else if (strEQ(s, "CHECK")) {
if (!PL_checkav)
@@ -4824,16 +4824,16 @@ Perl_newXS(pTHX_ char *name, XSUBADDR_t subaddr, char *filename)
if (PL_main_start && ckWARN(WARN_VOID))
Perl_warner(aTHX_ WARN_VOID, "Too late to run CHECK block");
av_unshift(PL_checkav, 1);
- av_store(PL_checkav, 0, SvREFCNT_inc(cv));
- GvCV(gv) = 0;
+ av_store(PL_checkav, 0, (SV*)cv);
+ GvCV(gv) = 0; /* cv has been hijacked */
}
else if (strEQ(s, "INIT")) {
if (!PL_initav)
PL_initav = newAV();
if (PL_main_start && ckWARN(WARN_VOID))
Perl_warner(aTHX_ WARN_VOID, "Too late to run INIT block");
- av_push(PL_initav, SvREFCNT_inc(cv));
- GvCV(gv) = 0;
+ av_push(PL_initav, (SV*)cv);
+ GvCV(gv) = 0; /* cv has been hijacked */
}
}
else