Re: Segv from new regex code when under threads.
Yves Orton [Mon, 12 Jun 2006 19:17:30 +0000 (21:17 +0200)]
Message-ID: <9b18b3110606121017t3af81484t4fb13015fac74592@mail.gmail.com>

p4raw-id: //depot/perl@28388

regcomp.c
win32/vmem.h

index 6165317..a891c48 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -1062,7 +1062,8 @@ S_make_trie_failtable(pTHX_ RExC_state_t *pRExC_state, regnode *source,  regnode
         (trie->laststate+1)*sizeof(reg_trie_state));
     Newxz( q, numstates, U32);
     Newxz( aho->fail, numstates, U32 );
-    fail= aho->fail;
+    aho->refcount = 1;
+    fail = aho->fail;
     fail[ 0 ] = fail[ 1 ] = 1;
 
     for ( charid = 0; charid < ucharcount ; charid++ ) {
index 3cb10a3..25f2376 100644 (file)
@@ -207,7 +207,8 @@ void VMem::Free(void* pMem)
                dTHX;
                int *nowhere = NULL;
                Perl_warn(aTHX_ "Free to wrong pool %p not %p",this,ptr->owner);
-               *nowhere = 0;
+               *nowhere = 0; /* this segfault is deliberate, 
+                                so you can see the stack trace */
 #else
                 ptr->owner->Free(pMem);        
 #endif