In perl.git, the branch smoke-me/khw-core has been updated <https://perl5.git.perl.org/perl.git/commitdiff/e491351db56e90296390c6800277e639cf3d8631?hp=b25e0aea610ad6f628a6ac66f7b57e1c00ee9ffc>
- Log ----------------------------------------------------------------- commit e491351db56e90296390c6800277e639cf3d8631 Author: Karl Williamson <[email protected]> Date: Mon Mar 11 20:32:26 2019 -0600 Revert "fix leak when compiling typed hash deref" This reverts commit 02a9632ac4bf515585a2f25b05b2939de1743ded. commit ce0b88847ec549ea7defbc9dc07cf79af7ef3bfa Author: Karl Williamson <[email protected]> Date: Mon Mar 11 20:32:05 2019 -0600 Revert "Fix leak on syntax error in main prog" This reverts commit ca6ebcd6405d5ab46fb0688c45dc44661698a7c0. ----------------------------------------------------------------------- Summary of changes: op.c | 27 ++++++++------------------- t/op/multideref.t | 11 +---------- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/op.c b/op.c index 4e49eeeedf..40bc2ef84e 100644 --- a/op.c +++ b/op.c @@ -2450,13 +2450,12 @@ S_modkids(pTHX_ OP *o, I32 type) /* for a helem/hslice/kvslice, if its a fixed hash, croak on invalid * const fields. Also, convert CONST keys to HEK-in-SVs. - * rop is the op that retrieves the hash; + * rop is the op that retrieves the hash; * key_op is the first key - * real if false, only check (and possibly croak); don't update op */ STATIC void -S_check_hash_fields_and_hekify(pTHX_ UNOP *rop, SVOP *key_op, int real) +S_check_hash_fields_and_hekify(pTHX_ UNOP *rop, SVOP *key_op) { PADNAME *lexname; GV **fields; @@ -2506,8 +2505,7 @@ S_check_hash_fields_and_hekify(pTHX_ UNOP *rop, SVOP *key_op, int real) if ( !SvIsCOW_shared_hash(sv = *svp) && SvTYPE(sv) < SVt_PVMG && SvOK(sv) - && !SvROK(sv) - && real) + && !SvROK(sv)) { SSize_t keylen; const char * const key = SvPV_const(sv, *(STRLEN*)&keylen); @@ -3733,7 +3731,7 @@ S_finalize_op(pTHX_ OP* o) check_keys: if (o->op_private & OPpLVAL_INTRO || rop->op_type != OP_RV2HV) rop = NULL; - S_check_hash_fields_and_hekify(aTHX_ rop, key_op, 1); + S_check_hash_fields_and_hekify(aTHX_ rop, key_op); break; } case OP_NULL: @@ -5415,10 +5413,7 @@ Perl_newPROG(pTHX_ OP *o) start = LINKLIST(PL_main_root); PL_main_root->op_next = 0; S_process_optree(aTHX_ NULL, PL_main_root, start); - if (!PL_parser->error_count) - /* on error, leave CV slabbed so that ops left lying around - * will eb cleaned up. Else unslab */ - cv_forget_slab(PL_compcv); + cv_forget_slab(PL_compcv); PL_compcv = 0; /* Register with debugger */ @@ -14696,13 +14691,12 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV orig_action, U8 hints) * the extra hassle for those edge cases */ break; - { + if (pass) { UNOP *rop = NULL; OP * helem_op = o->op_next; ASSUME( helem_op->op_type == OP_HELEM - || helem_op->op_type == OP_NULL - || pass == 0); + || helem_op->op_type == OP_NULL); if (helem_op->op_type == OP_HELEM) { rop = (UNOP*)(((BINOP*)helem_op)->op_first); if ( helem_op->op_private & OPpLVAL_INTRO @@ -14710,14 +14704,9 @@ S_maybe_multideref(pTHX_ OP *start, OP *orig_o, UV orig_action, U8 hints) ) rop = NULL; } - /* on first pass just check; on second pass - * hekify */ - S_check_hash_fields_and_hekify(aTHX_ rop, cSVOPo, - pass); - } + S_check_hash_fields_and_hekify(aTHX_ rop, cSVOPo); #ifdef USE_ITHREADS - if (pass) { /* Relocate sv to the pad for thread safety */ op_relocate_sv(&cSVOPo->op_sv, &o->op_targ); arg->pad_offset = o->op_targ; diff --git a/t/op/multideref.t b/t/op/multideref.t index 12b04536e5..20ba1ca614 100644 --- a/t/op/multideref.t +++ b/t/op/multideref.t @@ -18,7 +18,7 @@ BEGIN { use warnings; use strict; -plan 64; +plan 63; # check that strict refs hint is handled @@ -233,12 +233,3 @@ sub defer {} is $x[qw(rt131627)->$*], 11, 'RT #131627: $a[qw(var)->$*]'; } -# this used to leak - run the code for ASan to spot any problems -{ - package Foo; - our %FIELDS = (); - my Foo $f; - eval q{ my $x = $f->{c}; }; - ::pass("S_maybe_multideref() shouldn't leak on croak"); -} - -- Perl5 Master Repository
