updated for version 7.4.519
Problem:    Crash when using syntax highlighting.
Solution:   When regprog is freed and replaced, store the result.
diff --git a/src/spell.c b/src/spell.c
index 1e52dfb..9d7f933 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -1154,11 +1154,14 @@
 	    if (capcol != NULL && wp->w_s->b_cap_prog != NULL)
 	    {
 		regmatch_T	regmatch;
+		int		r;
 
 		/* Check for end of sentence. */
 		regmatch.regprog = wp->w_s->b_cap_prog;
 		regmatch.rm_ic = FALSE;
-		if (vim_regexec(&regmatch, ptr, 0))
+		r = vim_regexec(&regmatch, ptr, 0);
+		wp->w_s->b_cap_prog = regmatch.regprog;
+		if (r)
 		    *capcol = (int)(regmatch.endp[0] - ptr);
 	    }
 
@@ -1786,7 +1789,6 @@
     char_u	*word;
     char_u	*flags;
 {
-    regmatch_T	regmatch;
 #ifdef FEAT_MBYTE
     char_u	uflags[MAXWLEN * 2];
     int		i;
@@ -1808,9 +1810,7 @@
     else
 #endif
 	p = flags;
-    regmatch.regprog = slang->sl_compprog;
-    regmatch.rm_ic = FALSE;
-    if (!vim_regexec(&regmatch, p, 0))
+    if (!vim_regexec_prog(&slang->sl_compprog, FALSE, p, 0))
 	return FALSE;
 
     /* Count the number of syllables.  This may be slow, do it last.  If there
@@ -1930,8 +1930,7 @@
 {
     int		prefcnt;
     int		pidx;
-    regprog_T	*rp;
-    regmatch_T	regmatch;
+    regprog_T	**rp;
     int		prefid;
 
     prefid = (unsigned)flags >> 24;
@@ -1950,12 +1949,10 @@
 
 	/* Check the condition, if there is one.  The condition index is
 	 * stored in the two bytes above the prefix ID byte.  */
-	rp = slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff];
-	if (rp != NULL)
+	rp = &slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff];
+	if (*rp != NULL)
 	{
-	    regmatch.regprog = rp;
-	    regmatch.rm_ic = FALSE;
-	    if (!vim_regexec(&regmatch, word, 0))
+	    if (!vim_regexec_prog(rp, FALSE, word, 0))
 		continue;
 	}
 	else if (cond_req)
@@ -6903,7 +6900,6 @@
     hashitem_T	*hi;
     affheader_T	*ah;
     affentry_T	*ae;
-    regmatch_T	regmatch;
     char_u	newword[MAXWLEN];
     int		retval = OK;
     int		i, j;
@@ -6944,15 +6940,14 @@
 		     * When a previously added affix had CIRCUMFIX this one
 		     * must have it too, if it had not then this one must not
 		     * have one either. */
-		    regmatch.regprog = ae->ae_prog;
-		    regmatch.rm_ic = FALSE;
 		    if ((xht != NULL || !affile->af_pfxpostpone
 				|| ae->ae_chop != NULL
 				|| ae->ae_flags != NULL)
 			    && (ae->ae_chop == NULL
 				|| STRLEN(ae->ae_chop) < wordlen)
 			    && (ae->ae_prog == NULL
-				|| vim_regexec(&regmatch, word, (colnr_T)0))
+				|| vim_regexec_prog(&ae->ae_prog, FALSE,
+							    word, (colnr_T)0))
 			    && (((condit & CONDIT_CFIX) == 0)
 				== ((condit & CONDIT_AFF) == 0
 				    || ae->ae_flags == NULL
@@ -10478,6 +10473,7 @@
 		break;
 	    }
 	}
+	curwin->w_s->b_cap_prog = regmatch.regprog;
     }
 
     vim_free(line_copy);