soap

simple xdg-open replacement with fallback
git clone git://git.2f30.org/soap
Log | Files | Refs | LICENSE

commit 59adcd33c1e354bfddfdd4ae86c142a348957a39
parent 6ad7be2b64423374a60a94398762d4792899b7a1
Author: Svyatoslav Mishyn <juef@openmailbox.org>
Date:   Tue,  9 Aug 2016 16:08:55 +0300

add REG_NOSUB flag and fix a memory leak

Diffstat:
Msoap.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/soap.c b/soap.c @@ -39,11 +39,12 @@ main(int argc, char *argv[]){ /* check regex and launch action if it matches argv[1] */ for (i=0; i < sizeof(pairs)/sizeof(*pairs); ++i) { - if (regcomp(&regex, pairs[i].regex, REG_EXTENDED)) + if (regcomp(&regex, pairs[i].regex, REG_EXTENDED | REG_NOSUB)) fprintf(stderr, "invalid regex: %s\n", pairs[i].regex); if (!regexec(&regex, argv[1], 0, NULL, 0)) { snprintf(cmd, sizeof cmd, pairs[i].action, sharg); system(cmd); + regfree(&regex); return EXIT_SUCCESS; } regfree(&regex);