diff options
author | Nicholas Clark <nick@ccl4.org> | 2003-11-02 21:28:01 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2003-11-02 21:28:01 +0000 |
commit | e990ff0d05737fc3bf6ede8ca32127dd3246e9e9 (patch) | |
tree | 5fe80003809ff77cc868364256e8976b07350923 | |
parent | 57701cb80f750895eeba9888f85637c4552a97de (diff) | |
download | perl-e990ff0d05737fc3bf6ede8ca32127dd3246e9e9.tar.gz |
[ 21628]
Fix for [perl #24347] segfault with Safe
The empty %INC created for safe compartements was freed
too early.
p4raw-link: @21628 on //depot/perl: 4adfac04910258ae156d305cec3778a76f618ae6
p4raw-id: //depot/maint-5.8/perl@21630
p4raw-integrated: from //depot/perl@21629 'copy in'
ext/Opcode/Opcode.xs (@16173..)
-rw-r--r-- | ext/Opcode/Opcode.xs | 5 |
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; |