diff --git a/src/color.c b/src/color.c
index 120c6d31..3631f6d0 100644
--- a/src/color.c
+++ b/src/color.c
@@ -169,7 +169,6 @@ bool found_in_list(regexlisttype *head, const char *shibboleth)
 void color_update(void)
 {
 	syntaxtype *sint = NULL;
-	colortype *ink;
 
 	/* If the rcfiles were not read, or contained no syntaxes, get out. */
 	if (syntaxes == NULL)
@@ -281,20 +280,6 @@ void color_update(void)
 
 	openfile->syntax = sint;
 	openfile->colorstrings = (sint == NULL ? NULL : sint->color);
-
-	/* If a syntax was found, compile its specified regexes (which have
-	 * already been checked for validity when they were read in). */
-	for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
-		if (ink->start == NULL) {
-			ink->start = (regex_t *)nmalloc(sizeof(regex_t));
-			regcomp(ink->start, ink->start_regex, ink->rex_flags);
-		}
-
-		if (ink->end_regex != NULL && ink->end == NULL) {
-			ink->end = (regex_t *)nmalloc(sizeof(regex_t));
-			regcomp(ink->end, ink->end_regex, ink->rex_flags);
-		}
-	}
 }
 
 /* Determine whether the matches of multiline regexes are still the same,
diff --git a/src/nano.c b/src/nano.c
index 96d0ae0a..4f41758a 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2669,6 +2669,8 @@ int main(int argc, char **argv)
 		/* Forget any earlier cursor position at the prompt. */
 		put_cursor_at_end_of_answer();
 
+		die("Stop\n");
+
 		/* Read in and interpret a single keystroke. */
 		do_input();
 	}
diff --git a/src/nano.h b/src/nano.h
index a5b85334..1c2e9b9d 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -194,12 +194,8 @@ typedef struct colortype {
 		/* Pair number and brightness composed into ready-to-use attributes. */
 	int rex_flags;
 		/* The regex compilation flags (with or without REG_ICASE). */
-	char *start_regex;
-		/* The start (or all) of the regex string. */
 	regex_t *start;
 		/* The compiled start (or all) of the regex string. */
-	char *end_regex;
-		/* The end (if any) of the regex string. */
 	regex_t *end;
 		/* The compiled end (if any) of the regex string. */
 	struct colortype *next;
diff --git a/src/rcfile.c b/src/rcfile.c
index e8b6c68a..dfa030fe 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -267,23 +267,21 @@ char *parse_next_regex(char *ptr)
 	return ptr;
 }
 
-/* Compile the regular expression regex to see if it's valid.  Return
- * TRUE if it is, and FALSE otherwise. */
-bool nregcomp(const char *regex, int compile_flags)
+/* Compile the given regular expression.  Return TRUE when it is valid,
+ * and return the compiled regex in *preg. */
+bool nregcomp(const char *regex, int compile_flags, regex_t *preg)
 {
-	regex_t preg;
-	int rc = regcomp(&preg, regex, compile_flags);
+	int rc = regcomp(preg, regex, compile_flags);
 
 	if (rc != 0) {
-		size_t len = regerror(rc, &preg, NULL, 0);
+		size_t len = regerror(rc, preg, NULL, 0);
 		char *str = charalloc(len);
 
-		regerror(rc, &preg, str, len);
+		regerror(rc, preg, str, len);
 		rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
 		free(str);
 	}
 
-	regfree(&preg);
 	return (rc == 0);
 }
 
@@ -736,6 +734,8 @@ void parse_colors(char *ptr, int rex_flags)
 	while (ptr != NULL && *ptr != '\0') {
 		colortype *newcolor = NULL;
 			/* The container for a color plus its regexes. */
+		regex_t *compiled = NULL;
+			/* A compiled regular expression. */
 		bool goodstart;
 			/* Whether the start expression was valid. */
 		bool expectend = FALSE;
@@ -760,8 +760,10 @@ void parse_colors(char *ptr, int rex_flags)
 		if (*item == '\0') {
 			rcfile_error(N_("Empty regex string"));
 			goodstart = FALSE;
-		} else
-			goodstart = nregcomp(item, rex_flags);
+		} else {
+			compiled = nmalloc(sizeof(regex_t));
+			goodstart = nregcomp(item, rex_flags, compiled);
+		}
 
 		/* If the starting regex is valid, initialize a new color struct,
 		 * and hook it in at the tail of the linked list. */
@@ -773,10 +775,7 @@ void parse_colors(char *ptr, int rex_flags)
 			newcolor->attributes = attributes;
 			newcolor->rex_flags = rex_flags;
 
-			newcolor->start_regex = mallocstrcpy(NULL, item);
-			newcolor->start = NULL;
-
-			newcolor->end_regex = NULL;
+			newcolor->start = compiled;
 			newcolor->end = NULL;
 
 			newcolor->next = NULL;
@@ -787,6 +786,9 @@ void parse_colors(char *ptr, int rex_flags)
 				lastcolor->next = newcolor;
 
 			lastcolor = newcolor;
+		} else {
+			regfree(compiled);
+			free(compiled);
 		}
 
 		if (!expectend)
@@ -818,9 +820,9 @@ void parse_colors(char *ptr, int rex_flags)
 		if (!goodstart)
 			continue;
 
-		/* If it's valid, save the ending regex string. */
-		if (nregcomp(item, rex_flags))
-			newcolor->end_regex = mallocstrcpy(NULL, item);
+		compiled = nmalloc(sizeof(regex_t));
+		nregcomp(item, rex_flags, compiled);
+		newcolor->end = compiled;
 
 		/* Lame way to skip another static counter. */
 		newcolor->id = live_syntax->nmultis;
@@ -877,6 +879,8 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
 	while (*ptr != '\0') {
 		const char *regexstring;
 		regexlisttype *newthing;
+		regex_t *compiled;
+		bool good;
 
 		if (*ptr != '"') {
 			rcfile_error(N_("Regex strings must begin and end with a \" character"));
@@ -888,8 +892,13 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
 		if (ptr == NULL)
 			return;
 
+		compiled = nmalloc(sizeof(regex_t));
+		good = nregcomp(regexstring, NANO_REG_EXTENDED | REG_NOSUB, compiled);
+		regfree(compiled);
+		free(compiled);
+
 		/* If the regex string is malformed, skip it. */
-		if (!nregcomp(regexstring, NANO_REG_EXTENDED | REG_NOSUB))
+		if (!good)
 			continue;
 
 		/* Copy the regex into a struct, and hook this in at the end. */
