Introduction
Introduction Statistics Contact Development Disclaimer Help
Plug regex memory leaks - noice - small file browser (mirror / fork from 2f30.o…
git clone git://git.codemadness.org/noice
Log
Files
Refs
README
LICENSE
---
commit fef811921b50a2e4a3501e4cef47286c855b4727
parent 2f11fc5427127bcfdf84dd4e1c71c5c91157088c
Author: Lazaros Koromilas <[email protected]>
Date: Sun, 25 Feb 2018 12:29:18 +0200
Plug regex memory leaks
Diffstat:
M noice.c | 10 ++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)
---
diff --git 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 */
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.