diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-10-08 11:59:47 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-10-08 16:58:10 +0100 |
commit | f9cc56fa8caacd402d316a1cd95160cd70fb4c9e (patch) | |
tree | 7c5065e08f7c931de98f5334ce4cd2a0f620b2e0 /util.c | |
parent | 0e7bfc0a13342232c7329dcc019fa6e7fe360521 (diff) | |
download | perl-f9cc56fa8caacd402d316a1cd95160cd70fb4c9e.tar.gz |
xs_version_bootcheck() must use mortals, as {new,upg}_version() can croak.
It's unlikely that XS_VERSION will contain a bogus version string (for long),
but the value passed in (or derived from $XS_VERSION or $VERSION) might well.
For that case, without this change, temporary SVs created within
xs_version_bootcheck() won't be freed (before interpreter exit).
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -6486,10 +6486,9 @@ Perl_xs_version_bootcheck(pTHX_ U32 items, U32 ax, const char *xs_p, } if (sv) { SV *xpt = NULL; - SV *xssv = Perl_newSVpvn(aTHX_ xs_p, xs_len); + SV *xssv = Perl_newSVpvn_flags(aTHX_ xs_p, xs_len, SVs_TEMP); SV *pmsv = sv_derived_from(sv, "version") - ? SvREFCNT_inc_simple_NN(sv) - : new_version(sv); + ? sv : sv_2mortal(new_version(sv)); xssv = upg_version(xssv, 0); if ( vcmp(pmsv,xssv) ) { xpt = Perl_newSVpvf(aTHX_ "%s object version %"SVf @@ -6501,11 +6500,8 @@ Perl_xs_version_bootcheck(pTHX_ U32 items, U32 ax, const char *xs_p, vn ? vn : "bootstrap parameter", SVfARG(Perl_sv_2mortal(aTHX_ vstringify(pmsv)))); Perl_sv_2mortal(aTHX_ xpt); - } - SvREFCNT_dec(xssv); - SvREFCNT_dec(pmsv); - if (xpt) Perl_croak_sv(aTHX_ xpt); + } } } |