diff options
| author | FRIGN <dev@frign.de> | 2016-08-11 21:30:34 +0200 |
|---|---|---|
| committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-08-11 23:42:09 +0200 |
| commit | 072a318adbdf091a58587c740d081d0ccfff271c (patch) | |
| tree | 260940920cbf9608a8be1238d93f857288de1139 | |
| parent | e8914d5d4bedb12bccf78a930b34b1564b3dbaac (diff) | |
| download | sent-072a318adbdf091a58587c740d081d0ccfff271c.tar.gz | |
Fix memory leak and print a warning on invalid regex
This will minimize the already low memory usage of sent.
| -rw-r--r-- | sent.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -185,12 +185,16 @@ ffload(Slide *s) 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); |