diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-10-30 14:38:27 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-10-30 14:38:27 -0700 |
commit | 360484937816649e28ccea4a7f63b878393922f2 (patch) | |
tree | d7b1bbfcbebcfdda2d4dc838402521c9edf4048c /utf8.c | |
parent | 8d919b0a35f2b57a6bed2f8355b25b19ac5ad0c5 (diff) | |
download | perl-360484937816649e28ccea4a7f63b878393922f2.tar.gz |
utf8.c: Stop _core_swash_init from leaking
If an %INC hook or $@ assignment dies, then a scalar is leaked. I
don’t know that it is possible to test this.
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2860,6 +2860,7 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m if (!method) { /* demand load utf8 */ ENTER; errsv_save = newSVsv(ERRSV); + SAVEFREESV(errsv_save); /* It is assumed that callers of this routine are not passing in * any user derived data. */ /* Need to do this after save_re_context() as it will set @@ -2872,7 +2873,6 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m NULL); if (!SvTRUE(ERRSV)) sv_setsv(ERRSV, errsv_save); - SvREFCNT_dec(errsv_save); LEAVE; } SPAGAIN; @@ -2885,6 +2885,7 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m mPUSHi(none); PUTBACK; errsv_save = newSVsv(ERRSV); + SAVEFREESV(errsv_save); /* If we already have a pointer to the method, no need to use * call_method() to repeat the lookup. */ if (method ? call_sv(MUTABLE_SV(method), G_SCALAR) @@ -2895,7 +2896,6 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m } if (!SvTRUE(ERRSV)) sv_setsv(ERRSV, errsv_save); - SvREFCNT_dec(errsv_save); LEAVE; POPSTACK; if (IN_PERL_COMPILETIME) { |