perl 5.003_01: cop.h
Perl 5 Porters [Fri, 5 Jul 1996 05:01:26 +0000 (05:01 +0000)]
Increment refcount on @_ when passed through to another sub,
so it's not freed twiceon return.

cop.h

diff --git a/cop.h b/cop.h
index b503309..bea47c4 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -52,6 +52,9 @@ struct block_sub {
        }                                                               \
        if (cx->blk_sub.cv) {                                           \
            if (!(CvDEPTH(cx->blk_sub.cv) = cx->blk_sub.olddepth)) {    \
+               if (cx->blk_sub.hasargs) {                              \
+                   SvREFCNT_inc((SV*)cx->blk_sub.argarray);            \
+               }                                                       \
                SvREFCNT_dec((SV*)cx->blk_sub.cv);                      \
            }                                                           \
        }