aboutsummaryrefslogtreecommitdiffstats
path: root/noice.c
diff options
context:
space:
mode:
authorLazaros Koromilas <lostd@2f30.org>2018-02-25 12:29:18 +0200
committerLazaros Koromilas <lostd@2f30.org>2018-02-25 12:29:18 +0200
commitfef811921b50a2e4a3501e4cef47286c855b4727 (patch)
tree51ee6bf062b4bfe60bfadad69832aea62f869801 /noice.c
parent2f11fc5427127bcfdf84dd4e1c71c5c91157088c (diff)
downloadnoice-fef811921b50a2e4a3501e4cef47286c855b4727.tar.gz
Plug regex memory leaks
Diffstat (limited to 'noice.c')
-rw-r--r--noice.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/noice.c b/noice.c
index 2dc895d..d78f030 100644
--- a/noice.c
+++ b/noice.c
@@ -213,8 +213,10 @@ openwith(char *file)
continue;
if (regexec(&regex, file, 0, NULL, 0) == 0) {
bin = assocs[i].bin;
+ regfree(&regex);
break;
}
+ regfree(&regex);
}
DPRINTF_S(bin);
return bin;
@@ -239,6 +241,12 @@ setfilter(regex_t *regex, char *filter)
}
void
+freefilter(regex_t *regex)
+{
+ regfree(regex);
+}
+
+void
initfilter(int dot, char **ifilter)
{
*ifilter = dot ? "." : "^[^.]";
@@ -520,6 +528,7 @@ populate(char *path, char *oldpath, char *fltr)
dents = NULL;
ndents = dentfill(path, &dents, visible, &re);
+ freefilter(&re);
qsort(dents, ndents, sizeof(*dents), entrycmp);
@@ -677,6 +686,7 @@ nochange:
r = setfilter(&re, tmp);
if (r != 0)
goto nochange;
+ freefilter(&re);
strlcpy(fltr, tmp, sizeof(fltr));
DPRINTF_S(fltr);
/* Save current */
Un proyecto texto-plano.xyz