This will minimize the already low memory usage of sent.
for (i = 0; i < LEN(filters); i++) {
if (regcomp(®ex, filters[i].regex,
- REG_NOSUB | REG_EXTENDED | REG_ICASE))
+ REG_NOSUB | REG_EXTENDED | REG_ICASE)) {
+ fprintf(stderr, "sent: Invalid regex '%s'\n", filters[i].regex);
continue;
+ }
if (!regexec(®ex, filename, 0, NULL, 0)) {
bin = filters[i].bin;
+ regfree(®ex);
break;
}
+ regfree(®ex);
}
if (!bin)
die("sent: Unable to find matching filter for file %s", filename);