diff --git a/ChangeLog b/ChangeLog
index 5700aab847f175a445a4e7324b8e1441cc5e4fc1..85d56b28da7b9dbeeddb2a1090f812fa9d2dd267 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-04  Benno Schulenberg  <bensberg@justemail.net>
+	* src/color.c (found_in_list): Don't bother keeping the compiled
+	regular expression when it matched -- drop this tiny optimization
+	for when opening multiple files.  Instead stop calling malloc().
+
 2016-03-01  Benno Schulenberg  <bensberg@justemail.net>
 	* src/rcfile.c (parse_syntax), src/color.c (color_update): Don't
 	bother discarding a duplicate syntax (it's too rare, saves little
diff --git a/src/color.c b/src/color.c
index 438ebc8de11038c005fdf781e52b31e8111253fe..e127e7bac823a7caeeba4db15228b3d7df60e83e 100644
--- a/src/color.c
+++ b/src/color.c
@@ -144,24 +144,17 @@ void color_init(void)
 bool found_in_list(regexlisttype *head, const char *shibboleth)
 {
     regexlisttype *item;
-    bool not_compiled;
+    regex_t rgx;
 
     for (item = head; item != NULL; item = item->next) {
-        not_compiled = (item->rgx == NULL);
+	regcomp(&rgx, fixbounds(item->full_regex), REG_EXTENDED);
 
-	if (not_compiled) {
-	    item->rgx = (regex_t *)nmalloc(sizeof(regex_t));
-	    regcomp(item->rgx, fixbounds(item->full_regex), REG_EXTENDED);
-	}
-
-	if (regexec(item->rgx, shibboleth, 0, NULL, 0) == 0)
+	if (regexec(&rgx, shibboleth, 0, NULL, 0) == 0) {
+	    regfree(&rgx);
 	    return TRUE;
-
-	if (not_compiled) {
-	    regfree(item->rgx);
-	    free(item->rgx);
-	    item->rgx = NULL;
 	}
+
+	regfree(&rgx);
     }
 
     return FALSE;