This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
hv can be left uninitialized.
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 27 Jun 2014 23:47:32 +0000 (19:47 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 27 Jun 2014 23:47:32 +0000 (19:47 -0400)
Stronger statement would be assert(), even stronger croak(),
but don't know the code well enough.

Coverity perl5 CIDs 68584 and 68585.

ext/Hash-Util/Util.xs

index 590023f..9481dc7 100644 (file)
@@ -139,7 +139,7 @@ bucket_info(rhv)
     nothing (the empty list).
 
     */
-    const HV * hv;
+    const HV * hv = NULL;
     if (SvROK(rhv) && SvTYPE(SvRV(rhv))==SVt_PVHV && !SvMAGICAL(SvRV(rhv))) {
         hv = (const HV *) SvRV(rhv);
     } else if (!SvOK(rhv)) {
@@ -199,7 +199,7 @@ bucket_array(rhv)
      * of the hash store, combined with regular remappings means that relative
      * order of keys changes each remap.
      */
-    const HV * hv;
+    const HV * hv = NULL;
     if (SvROK(rhv) && SvTYPE(SvRV(rhv))==SVt_PVHV && !SvMAGICAL(SvRV(rhv))) {
         hv = (const HV *) SvRV(rhv);
     } else if (!SvOK(rhv)) {