This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
assert(arg) before derefing it since it can be NULL.
authorJarkko Hietaniemi <jhi@iki.fi>
Thu, 25 Jun 2015 01:03:21 +0000 (21:03 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 27 Jun 2015 03:09:46 +0000 (23:09 -0400)
Coverity CID 104813.

pp.c

diff --git a/pp.c b/pp.c
index d6fe789..af2270e 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -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,