cx->sb_rx = rx, \
cx->cx_type = CXt_SUBST | (once ? CXp_ONCE : 0); \
rxres_save(&cx->sb_rxres, rx); \
- (void)ReREFCNT_inc(rx)
+ (void)ReREFCNT_inc(rx); \
+ SvREFCNT_inc_void_NN(targ)
# define POPSUBST(cx) cx = &cxstack[cxstack_ix--]; \
rxres_free(&cx->sb_rxres); \
- ReREFCNT_dec(cx->sb_rx)
+ ReREFCNT_dec(cx->sb_rx); \
+ SvREFCNT_dec_NN(cx->sb_targ)
#endif
#define CxONCE(cx) ((cx)->cx_type & CXp_ONCE)
require './loc_tools.pl';
}
-plan( tests => 267 );
+plan( tests => 268 );
$_ = 'david';
$a = s/david/rules/r;
$s1 =~ s/.?/$s1++/ge;
is($s1, "01","RT #123954 s1");
}
+{
+ # RT #126602 double free if the value being modified is freed in the replacement
+ fresh_perl_is('s//*_=0;s|0||;00.y0/e; print qq(ok\n)', "ok\n", { stderr => 1 },
+ "[perl #126602] s//*_=0;s|0||/e crashes");
+}