Change 34275 by [EMAIL PROTECTED] on 2008/09/05 15:12:25

        Integrate:
        [ 34220]
        Don't add freed SVF_BREAK scalars to the freed list.
        This may still be referenced, so don't reuse.

Affected files ...

... //depot/maint-5.10/perl/sv.c#24 integrate

Differences ...

==== //depot/maint-5.10/perl/sv.c#24 (text) ====
Index: perl/sv.c
--- perl/sv.c#23~34269~ 2008-09-05 05:18:53.000000000 -0700
+++ perl/sv.c   2008-09-05 08:12:25.000000000 -0700
@@ -189,13 +189,23 @@
 #  define POSION_SV_HEAD(sv)
 #endif
 
+/* Mark an SV head as unused, and add to free list.
+ *
+ * If SVf_BREAK is set, skip adding it to the free list, as this SV had
+ * its refcount artificially decremented during global destruction, so
+ * there may be dangling pointers to it. The last thing we want in that
+ * case is for it to be reused. */
+
 #define plant_SV(p) \
     STMT_START {                                       \
+       const U32 old_flags = SvFLAGS(p);                       \
        FREE_SV_DEBUG_FILE(p);                          \
        POSION_SV_HEAD(p);                              \
-       SvARENA_CHAIN(p) = (void *)PL_sv_root;          \
        SvFLAGS(p) = SVTYPEMASK;                        \
-       PL_sv_root = (p);                               \
+       if (!(old_flags & SVf_BREAK)) {         \
+           SvARENA_CHAIN(p) = (void *)PL_sv_root;      \
+           PL_sv_root = (p);                           \
+       }                                               \
        --PL_sv_count;                                  \
     } STMT_END
 
End of Patch.

Reply via email to