Commit 5295cfe7 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

add missing bit from last patch

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2949 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 10 additions and 1 deletion
+10 -1
......@@ -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);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment