From cc34d8c5166167fcc3b2144eab4efb369901f305 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 18 Nov 2012 18:44:16 -0800 Subject: [PATCH] utf8.c: Fix a minor refcounting bug caused by 02c8547 Under some circumstances it could cause a hash to point to a freed element. But the hash itself was leaking, so it caused on problems, as no attempt to free its element again was made. The next commit will stop the hash from leaking. --- utf8.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utf8.c b/utf8.c index bde7f87..62b9135 100644 --- a/utf8.c +++ b/utf8.c @@ -2998,6 +2998,9 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m { Perl_croak(aTHX_ "panic: hv_store() unexpectedly failed"); } + /* We just stole a reference count. */ + if (swash_invlist_unclaimed) swash_invlist_unclaimed = FALSE; + else SvREFCNT_inc_simple_void_NN(swash_invlist); } if ((int) _invlist_len(swash_invlist) <= invlist_swash_boundary) { -- 2.7.4