summaryrefslogtreecommitdiff
path: root/ext/Opcode/Opcode.xs
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-11-02 21:05:59 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-11-02 21:05:59 +0000
commit4adfac04910258ae156d305cec3778a76f618ae6 (patch)
tree0fef9479c068e1552248c7611f7842c1ec2f23c0 /ext/Opcode/Opcode.xs
parentdc9b1d22fd894bd3f8cd8578ad6e29d34151f62c (diff)
downloadperl-4adfac04910258ae156d305cec3778a76f618ae6.tar.gz
Fix for [perl #24347] segfault with Safe
The empty %INC created for safe compartements was freed too early. p4raw-id: //depot/perl@21628
Diffstat (limited to 'ext/Opcode/Opcode.xs')
-rw-r--r--ext/Opcode/Opcode.xs5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs
index 66710edeb7..51be8bf776 100644
--- a/ext/Opcode/Opcode.xs
+++ b/ext/Opcode/Opcode.xs
@@ -288,6 +288,7 @@ _safe_call_sv(Package, mask, codesv)
PPCODE:
char op_mask_buf[OP_MASK_BUF_SIZE];
GV *gv;
+ HV *dummy_hv;
ENTER;
@@ -311,12 +312,12 @@ PPCODE:
GvHV(gv) = (HV*)SvREFCNT_inc(PL_defstash);
/* %INC must be clean for use/require in compartment */
- save_hash(PL_incgv);
- sv_free((SV*)GvHV(PL_incgv)); /* get rid of what save_hash gave us*/
+ dummy_hv = save_hash(PL_incgv);
GvHV(PL_incgv) = (HV*)SvREFCNT_inc(GvHV(gv_HVadd(gv_fetchpv("INC",TRUE,SVt_PVHV))));
PUSHMARK(SP);
perl_call_sv(codesv, GIMME|G_EVAL|G_KEEPERR); /* use callers context */
+ sv_free(dummy_hv); /* get rid of what save_hash gave us*/
SPAGAIN; /* for the PUTBACK added by xsubpp */
LEAVE;