Commit 3674c1da authored by Chris Allegretta's avatar Chris Allegretta
Browse files

- winio.c:edit_add() - Add in the necessary regfree() calls to stop nano from...

- winio.c:edit_add() - Add in the necessary regfree() calls to stop nano from leaking memory like a sieve when using color syntax highlighting :-)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1207 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 6232d665
Showing with 21 additions and 5 deletions
+21 -5
......@@ -74,6 +74,8 @@ CVS code -
- winio.c:
edit_add()
- Changed some syntax hilight computations for the sake of COLS.
- Add in the necessary regfree() calls to stop nano from leaking
memory like a sieve when using color syntax highlighting :-)
botombars(), onekey()
- Cleanups (David Benbennick).
- po/gl.po:
......
......@@ -856,6 +856,8 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
k += colormatches[0].rm_eo;
}
regfree(&color_regexp);
}
/* Now, if there's an 'end' somewhere below, and a 'start'
somewhere above, things get really fun. We have to look
......@@ -868,9 +870,12 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
while (s != NULL) {
regcomp(&color_regexp, tmpcolor->start, 0);
if (!regexec
(&color_regexp, s->data, 1, colormatches, 0))
(&color_regexp, s->data, 1, colormatches, 0)) {
regfree(&color_regexp);
break;
}
s = s->prev;
regfree(&color_regexp);
}
if (s != NULL) {
......@@ -881,9 +886,12 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
while (e != NULL && e != fileptr) {
regcomp(&color_regexp, tmpcolor->end, 0);
if (!regexec
(&color_regexp, e->data, 1, colormatches, 0))
(&color_regexp, e->data, 1, colormatches, 0)) {
regfree(&color_regexp);
break;
}
e = e->next;
regfree(&color_regexp);
}
if (e != fileptr)
......@@ -893,9 +901,12 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
regcomp(&color_regexp, tmpcolor->end, 0);
if (!regexec
(&color_regexp, e->data, 1, colormatches,
0))
0)) {
regfree(&color_regexp);
break;
}
e = e->next;
regfree(&color_regexp);
}
if (e == NULL)
......@@ -907,9 +918,11 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
regcomp(&color_regexp, tmpcolor->end, 0);
if (!regexec
(&color_regexp, e->data, 1,
colormatches, 0))
colormatches, 0)) {
regfree(&color_regexp);
break;
e = e->next;
} e = e->next;
regfree(&color_regexp);
}
if (e == NULL)
......@@ -960,6 +973,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
}
}
#endif /* ENABLE_COLOR */
#ifndef NANO_SMALL
......
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