diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2015-06-24 21:03:21 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2015-06-26 23:09:46 -0400 |
commit | 38bb0011ea854565b1e4b9ff988bb7a3913ff52d (patch) | |
tree | e3c4376e3ab74faa338c06c19195939e377ed309 /pp.c | |
parent | 79713c7c7bd61bea80ac0300ea800374e775cfec (diff) | |
download | perl-38bb0011ea854565b1e4b9ff988bb7a3913ff52d.tar.gz |
assert(arg) before derefing it since it can be NULL.
Coverity CID 104813.
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -6418,13 +6418,16 @@ PP(pp_lvref) mg->mg_flags |= MGf_PERSIST; if (UNLIKELY(PL_op->op_private & OPpLVAL_INTRO)) { if (elem) { - MAGIC *mg; - HV *stash; - const bool can_preserve = SvCANEXISTDELETE(arg); - if (SvTYPE(arg) == SVt_PVAV) - S_localise_aelem_lval(aTHX_ (AV *)arg, elem, can_preserve); - else - S_localise_helem_lval(aTHX_ (HV *)arg, elem, can_preserve); + MAGIC *mg; + HV *stash; + assert(arg); + { + const bool can_preserve = SvCANEXISTDELETE(arg); + if (SvTYPE(arg) == SVt_PVAV) + S_localise_aelem_lval(aTHX_ (AV *)arg, elem, can_preserve); + else + S_localise_helem_lval(aTHX_ (HV *)arg, elem, can_preserve); + } } else if (arg) { S_localise_gv_slot(aTHX_ (GV *)arg, |