mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Free regex
This commit is contained in:
parent
7e099c2d53
commit
dbf60734ba
9
nnn.c
9
nnn.c
|
@ -908,10 +908,13 @@ getmime(const char *file)
|
|||
for (i = 0; i < len; ++i) {
|
||||
if (regcomp(®ex, assocs[i].regex, REG_NOSUB | REG_EXTENDED | REG_ICASE) != 0)
|
||||
continue;
|
||||
if (regexec(®ex, file, 0, NULL, 0) == 0)
|
||||
if (regexec(®ex, file, 0, NULL, 0) == 0) {
|
||||
regfree(®ex);
|
||||
return assocs[i].mime;
|
||||
}
|
||||
}
|
||||
|
||||
regfree(®ex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1080,6 +1083,8 @@ matches(char *fltr)
|
|||
return -1;
|
||||
|
||||
fill(&dents, visible, &re);
|
||||
regfree(&re);
|
||||
|
||||
qsort(dents, ndents, sizeof(*dents), entrycmp);
|
||||
|
||||
return 0;
|
||||
|
@ -2218,6 +2223,7 @@ populate(char *path, char *oldname, char *fltr)
|
|||
#endif
|
||||
|
||||
ndents = dentfill(path, &dents, visible, &re);
|
||||
regfree(&re);
|
||||
|
||||
qsort(dents, ndents, sizeof(*dents), entrycmp);
|
||||
|
||||
|
@ -2228,7 +2234,6 @@ populate(char *path, char *oldname, char *fltr)
|
|||
|
||||
/* Find cur from history */
|
||||
cur = dentfind(dents, oldname, ndents);
|
||||
regfree(&re);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue