summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2014-12-01 12:43:16 -0500
committerFather Chrysostomos <sprout@cpan.org>2014-12-01 13:52:36 -0800
commit64c909d3055a7d5436012fab51eb1c046088140a (patch)
tree8f30416934c4b493dfc09262953a93541c8e4fcc /sv.c
parenta2d725a2585df47821024d25ea39e658a50b9db4 (diff)
downloadperl-64c909d3055a7d5436012fab51eb1c046088140a.tar.gz
fix segv for psudofork duping of SAVEt_GP_ALIASED_SV
op/fork.t test 6 that contains "@a = (1..3);" will crash on Win32 with special debugging heap and race condition rarely crash otherwise. Refcnt mistake is from commit ff2a62e0c8 . See perl #40565 for details.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index 7384221d1d..9a9a449eeb 100644
--- a/sv.c
+++ b/sv.c
@@ -14207,11 +14207,13 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
ptr = POPPTR(ss,ix);
TOPPTR(nss,ix) = parser_dup((const yy_parser*)ptr, param);
break;
- case SAVEt_GP_ALIASED_SV:
- ptr = POPPTR(ss,ix);
- TOPPTR(nss,ix) = gp_dup((GP *)ptr, param);
- ((GP *)ptr)->gp_refcnt++;
+ case SAVEt_GP_ALIASED_SV: {
+ GP * gp_ptr = POPPTR(ss,ix);
+ GP * new_gp_ptr = gp_dup(gp_ptr, param);
+ TOPPTR(nss,ix) = new_gp_ptr;
+ new_gp_ptr->gp_refcnt++;
break;
+ }
default:
Perl_croak(aTHX_
"panic: ss_dup inconsistency (%"IVdf")", (IV) type);