From 5295cfe72c084690b565b248aebace2ddba1e783 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 29 Jul 2005 21:59:44 +0000 Subject: [PATCH] add missing bit from last patch git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2949 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- src/color.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/color.c b/src/color.c index 4d9b1938..496df03d 100644 --- a/src/color.c +++ b/src/color.c @@ -118,10 +118,12 @@ void color_update(void) exttype *e; for (e = tmpsyntax->extensions; e != NULL; e = e->next) { + bool compiled = (e->ext != NULL); + /* e->ext_regex has already been checked for validity * elsewhere. Compile its specified regex if we haven't * already. */ - if (e->ext == NULL) { + if (!compiled) { e->ext = (regex_t *)nmalloc(sizeof(regex_t)); regcomp(e->ext, e->ext_regex, REG_EXTENDED); } @@ -132,6 +134,13 @@ void color_update(void) if (openfile->colorstrings != NULL) break; + + /* Decompile e->ext_regex's specified regex if we aren't + * going to use it. */ + if (!compiled) { + regfree(e->ext); + free(e->ext); + } } } -- 2.39.5