From: Gurusamy Sarathy Date: Sat, 18 Jul 1998 04:23:12 +0000 (+0000) Subject: fix lvalue leaks stemming from failure to free LvTARG(sv) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=02270b4e1187bc8d0def222ae3fb78581e1dc745;p=p5sagit%2Fp5-mst-13.2.git fix lvalue leaks stemming from failure to free LvTARG(sv) p4raw-id: //depot/perl@1528 --- diff --git a/ObjXSub.h b/ObjXSub.h index f8adba8..824da89 100644 --- a/ObjXSub.h +++ b/ObjXSub.h @@ -1103,8 +1103,6 @@ #define magic_clearsig pPerl->Perl_magic_clearsig #undef magic_existspack #define magic_existspack pPerl->Perl_magic_existspack -#undef magic_freedefelem -#define magic_freedefelem pPerl->Perl_magic_freedefelem #undef magic_freeregexp #define magic_freeregexp pPerl->Perl_magic_freeregexp #undef magic_get diff --git a/embed.h b/embed.h index 5bf6725..e7f8a50 100644 --- a/embed.h +++ b/embed.h @@ -278,7 +278,6 @@ #define magic_clearpack Perl_magic_clearpack #define magic_clearsig Perl_magic_clearsig #define magic_existspack Perl_magic_existspack -#define magic_freedefelem Perl_magic_freedefelem #define magic_freeregexp Perl_magic_freeregexp #define magic_get Perl_magic_get #define magic_getarylen Perl_magic_getarylen diff --git a/global.sym b/global.sym index 11f09f8..9a9ada6 100644 --- a/global.sym +++ b/global.sym @@ -377,7 +377,6 @@ magic_clearenv magic_clearpack magic_clearsig magic_existspack -magic_freedefelem magic_freeregexp magic_get magic_getarylen diff --git a/mg.c b/mg.c index 09441b3..faceff4 100644 --- a/mg.c +++ b/mg.c @@ -1386,13 +1386,6 @@ magic_setdefelem(SV *sv, MAGIC *mg) return 0; } -int -magic_freedefelem(SV *sv, MAGIC *mg) -{ - SvREFCNT_dec(LvTARG(sv)); - return 0; -} - void vivify_defelem(SV *sv) { diff --git a/objpp.h b/objpp.h index d65a5b8..e0c2f24 100644 --- a/objpp.h +++ b/objpp.h @@ -555,8 +555,6 @@ #define magic_clearsig CPerlObj::Perl_magic_clearsig #undef magic_existspack #define magic_existspack CPerlObj::Perl_magic_existspack -#undef magic_freedefelem -#define magic_freedefelem CPerlObj::Perl_magic_freedefelem #undef magic_freeregexp #define magic_freeregexp CPerlObj::Perl_magic_freeregexp #undef magic_get diff --git a/perl.h b/perl.h index 6d4cea7..b05119d 100644 --- a/perl.h +++ b/perl.h @@ -2078,7 +2078,7 @@ EXT MGVTBL vtbl_uvar = {magic_getuvar, EXT MGVTBL vtbl_mutex = {0, 0, 0, 0, magic_mutexfree}; #endif /* USE_THREADS */ EXT MGVTBL vtbl_defelem = {magic_getdefelem,magic_setdefelem, - 0, 0, magic_freedefelem}; + 0, 0, 0}; EXT MGVTBL vtbl_regexp = {0,0,0,0, magic_freeregexp}; diff --git a/proto.h b/proto.h index 59b2488..2908222 100644 --- a/proto.h +++ b/proto.h @@ -209,7 +209,6 @@ VIRTUAL int magic_clear_all_env _((SV* sv, MAGIC* mg)); VIRTUAL int magic_clearpack _((SV* sv, MAGIC* mg)); VIRTUAL int magic_clearsig _((SV* sv, MAGIC* mg)); VIRTUAL int magic_existspack _((SV* sv, MAGIC* mg)); -VIRTUAL int magic_freedefelem _((SV* sv, MAGIC* mg)); VIRTUAL int magic_freeregexp _((SV* sv, MAGIC* mg)); VIRTUAL int magic_get _((SV* sv, MAGIC* mg)); VIRTUAL int magic_getarylen _((SV* sv, MAGIC* mg)); diff --git a/sv.c b/sv.c index 46b51a3..29c45fd 100644 --- a/sv.c +++ b/sv.c @@ -2905,6 +2905,9 @@ sv_clear(register SV *sv) case SVt_PVAV: av_undef((AV*)sv); break; + case SVt_PVLV: + SvREFCNT_dec(LvTARG(sv)); + goto freescalar; case SVt_PVGV: gp_free((GV*)sv); Safefree(GvNAME(sv)); @@ -2914,7 +2917,6 @@ sv_clear(register SV *sv) -- JohnPC, 27 Mar 1998 */ stash = GvSTASH(sv); /* FALL THROUGH */ - case SVt_PVLV: case SVt_PVMG: case SVt_PVNV: case SVt_PVIV: diff --git a/t/op/substr.t b/t/op/substr.t index fe53f01..87efcb4 100755 --- a/t/op/substr.t +++ b/t/op/substr.t @@ -2,8 +2,6 @@ print "1..106\n"; -$ENV{PERL_DESTRUCT_LEVEL} = 0; # XXX known to leaks scalars - #P = start of string Q = start of substr R = end of substr S = end of string $a = 'abcdefxyz'; diff --git a/t/op/vec.t b/t/op/vec.t index 5ae2247..7117144 100755 --- a/t/op/vec.t +++ b/t/op/vec.t @@ -4,8 +4,6 @@ print "1..15\n"; -$ENV{PERL_DESTRUCT_LEVEL} = 0; # XXX known to leaks scalars - print vec($foo,0,1) == 0 ? "ok 1\n" : "not ok 1\n"; print length($foo) == 0 ? "ok 2\n" : "not ok 2\n"; vec($foo,0,1) = 1;