Hi mattn!

On Mi, 26 Nov 2014, mattn wrote:

> It seems still occuring SEGV.
> 
> -----
> :syntax on
> :h options
> :set regexpengine=0
> :let m = matchadd('Error', '\_.*')
> -----
> 
> vim -N -u NONE -S test.vim
> 
> Then, type jjjjj

Okay, here is a fix.

Best,
Christian
-- 
Herz, mein Herz, sei nicht beklommen und ertrage dein Geschick! Neuer
Frühling gibt zurück, was der Winter dir genommen.
                -- Heinrich Heine

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/regexp.c b/src/regexp.c
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -258,6 +258,7 @@
 
 static int no_Magic __ARGS((int x));
 static int toggle_Magic __ARGS((int x));
+static int regprog_in_matchlist __ARGS((win_T *wp, regprog_T *regprog));
 
     static int
 no_Magic(x)
@@ -277,6 +278,28 @@ toggle_Magic(x)
     return Magic(x);
 }
 
+
+/* Check, if the given regprog is in the matchlist of the given window */
+static int
+regprog_in_matchlist(win, regprog)
+    win_T       *win;
+    regprog_T	*regprog;
+{
+#ifdef FEAT_SEARCH_EXTRA
+    if (win != NULL)
+    {
+	matchitem_T *cur = win->w_match_head;
+	while (cur != NULL)
+	{
+	    if (cur->hl.rm.regprog == regprog)
+		return TRUE;
+	    cur = cur->next;
+	}
+    }
+#endif
+    return FALSE;
+}
+
 /*
  * The first byte of the regexp internal "program" is actually this magic
  * number; the start node begins in the second byte.  It's used to catch the
@@ -8284,7 +8307,9 @@ vim_regexec_multi(rmp, win, buf, lnum, c
 	char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern);
 
 	p_re = BACKTRACKING_ENGINE;
-	vim_regfree(rmp->regprog);
+	/* don't free the regprog if it comes from the matchlist */
+	if (!regprog_in_matchlist(win, rmp->regprog))
+	    vim_regfree(rmp->regprog);
 	if (pat != NULL)
 	{
 #ifdef FEAT_EVAL

Raspunde prin e-mail lui