updated for version 7.3.1149
Problem:    New regexp engine: Matching plain text could be faster.
Solution:   Detect a plain text match and handle it specifically.  Add
            vim_regfree().
diff --git a/src/regexp.c b/src/regexp.c
index ae29ef5..ef8c78d 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1297,7 +1297,8 @@
     return p;
 }
 
-static regprog_T    *bt_regcomp __ARGS((char_u *expr, int re_flags));
+static regprog_T  *bt_regcomp __ARGS((char_u *expr, int re_flags));
+static void bt_regfree __ARGS((regprog_T *prog));
 
 /*
  * bt_regcomp() - compile a regular expression into internal code for the
@@ -1455,6 +1456,16 @@
 }
 
 /*
+ * Free a compiled regexp program, returned by bt_regcomp().
+ */
+    static void
+bt_regfree(prog)
+    regprog_T   *prog;
+{
+    vim_free(prog);
+}
+
+/*
  * Setup to parse the regexp.  Used once to get the length and once to do it.
  */
     static void
@@ -7876,6 +7887,7 @@
 static regengine_T bt_regengine =
 {
     bt_regcomp,
+    bt_regfree,
     bt_regexec,
 #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
 	|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
@@ -7893,6 +7905,7 @@
 static regengine_T nfa_regengine =
 {
     nfa_regcomp,
+    nfa_regfree,
     nfa_regexec,
 #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
 	|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
@@ -7920,7 +7933,9 @@
 
 /*
  * Compile a regular expression into internal code.
- * Returns the program in allocated memory.  Returns NULL for an error.
+ * Returns the program in allocated memory.
+ * Use vim_regfree() to free the memory.
+ * Returns NULL for an error.
  */
     regprog_T *
 vim_regcomp(expr_arg, re_flags)
@@ -7997,6 +8012,17 @@
 }
 
 /*
+ * Free a compiled regexp program, returned by vim_regcomp().
+ */
+    void
+vim_regfree(prog)
+    regprog_T   *prog;
+{
+    if (prog != NULL)
+	prog->engine->regfree(prog);
+}
+
+/*
  * Match a regexp against a string.
  * "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
  * Uses curbuf for line count and 'iskeyword'.