summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2008-08-20 23:43:01 +0000
committerDave Mitchell <davem@fdisolutions.com>2008-08-20 23:43:01 +0000
commit41fae7a143a727427be3286c0c9dea8033177568 (patch)
treebdf765294281ec2f316ceb7d02b041997e0f8169 /sv.c
parentb17f5ab768c4daa8faac6c85c0c20d3895f406e1 (diff)
downloadperl-41fae7a143a727427be3286c0c9dea8033177568.tar.gz
Assert that backreferences array is not freed rather than handling it
In several places where the weakrefs backreferences array is used or freed, the code checks whether the array has already been freed and if so skips. Since the array already being freed is a bad bug, lets instead assert that this never happens, based on the assumptions that (a) such premature freeing bugs are likely ironed out by now, (b) if they aren't then we want to know about them and fix them rather than silently skip. p4raw-id: //depot/perl@34210
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sv.c b/sv.c
index 4792ad1f04..6957382ed8 100644
--- a/sv.c
+++ b/sv.c
@@ -5086,14 +5086,11 @@ S_sv_del_backref(pTHX_ SV *const tsv, SV *const sv)
if (mg)
av = (AV *)mg->mg_obj;
}
- if (!av) {
- if (PL_in_clean_all)
- return;
+
+ if (!av)
Perl_croak(aTHX_ "panic: del_backref");
- }
- if (SvIS_FREED(av))
- return;
+ assert(!SvIS_FREED(av));
svp = AvARRAY(av);
/* We shouldn't be in here more than once, but for paranoia reasons lets
@@ -5123,9 +5120,8 @@ Perl_sv_kill_backrefs(pTHX_ SV *const sv, AV *const av)
PERL_ARGS_ASSERT_SV_KILL_BACKREFS;
PERL_UNUSED_ARG(sv);
- /* Not sure why the av can get freed ahead of its sv, but somehow it does
- in ext/B/t/bytecode.t test 15 (involving print <DATA>) */
- if (svp && !SvIS_FREED(av)) {
+ assert(!svp || !SvIS_FREED(av));
+ if (svp) {
SV *const *const last = svp + AvFILLp(av);
while (svp <= last) {