This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #112358] Storable: Don’t create RV with no refcnt
[perl5.git] / dist / Storable / Storable.xs
index ca6f9b4..30f9281 100644 (file)
@@ -2916,9 +2916,8 @@ static int store_hook(
 
        TRACEME(("about to call STORABLE_freeze on class %s", classname));
 
-       ref = newRV_noinc(sv);                          /* Temporary reference */
+       ref = newRV_inc(sv);                            /* Temporary reference */
        av = array_call(aTHX_ ref, hook, clone);        /* @a = $object->STORABLE_freeze($c) */
-       SvRV_set(ref, NULL);
        SvREFCNT_dec(ref);                                      /* Reclaim temporary reference */
 
        count = AvFILLp(av) + 1;