In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/55acc4e8965e74959640ece8bb7247be97fd4bd0?hp=b7613b8a45c70113cb7f32d0bcfc9a03889ae272>

- Log -----------------------------------------------------------------
commit 55acc4e8965e74959640ece8bb7247be97fd4bd0
Author: David Mitchell <[email protected]>
Date:   Thu Feb 26 14:31:55 2015 +0000

    init a var in sv_clear() to keep Coverity happy.
    
    When a new hash is found to iterate over, the old value of hash_index (if
    any) is temporarily saved (in the new hash), then restored after the hash
    has been iterated over.
    This means that the first hash encountered causes the random initial
    value of hash_index to be saved and then restored. This is perfectly
    harmless, but makes Coverity unhappy. Since other such tools might also
    in future detect such dabbling with uninitialised values, its simplest
    (but unnecessary) to initialise this var to zero.
-----------------------------------------------------------------------

Summary of changes:
 sv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sv.c b/sv.c
index 182176a..45f7066 100644
--- a/sv.c
+++ b/sv.c
@@ -6520,7 +6520,8 @@ Perl_sv_clear(pTHX_ SV *const orig_sv)
     SV* iter_sv = NULL;
     SV* next_sv = NULL;
     SV *sv = orig_sv;
-    STRLEN hash_index;
+    STRLEN hash_index = 0; /* initialise to make Coverity et al happy.
+                              Not strictly necessary */
 
     PERL_ARGS_ASSERT_SV_CLEAR;
 

--
Perl5 Master Repository

Reply via email to