diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2019-07-13 14:54:01 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2019-07-13 14:54:01 +0200 |
commit | 7bbf4ae1401bc6e40f71a32d3f97952796d85690 (patch) | |
tree | 61c3edf1a277547ecd11903427a31cd09cf42b8a /sample/posix.c | |
parent | f883fa5bd37b6420f5dc25027a68289c64028063 (diff) | |
parent | 62c49103a575c79d20d524b36d1b7c4db9515dbf (diff) |
Merge branch 'release/debian/6.9.2-1'debian/6.9.2-1
Diffstat (limited to 'sample/posix.c')
-rw-r--r-- | sample/posix.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sample/posix.c b/sample/posix.c index 65bcf51..35ccb68 100644 --- a/sample/posix.c +++ b/sample/posix.c @@ -16,6 +16,7 @@ static int x(regex_t* reg, unsigned char* pattern, unsigned char* str) if (r != 0 && r != REG_NOMATCH) { regerror(r, reg, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); + regfree(reg); return -1; } @@ -28,6 +29,7 @@ static int x(regex_t* reg, unsigned char* pattern, unsigned char* str) fprintf(stderr, "%d: %d-%d\n", i, pmatch[i].rm_so, pmatch[i].rm_eo); } } + regfree(reg); return 0; } @@ -46,6 +48,7 @@ extern int main(int argc, char* argv[]) if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); + regfree(®); return -1; } x(®, pattern, (UChar* )"aaabbbbd"); @@ -56,6 +59,7 @@ extern int main(int argc, char* argv[]) if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); + regfree(®); return -1; } x(®, pattern, (UChar* )"a+b{2,7}d?|uuu"); @@ -66,6 +70,7 @@ extern int main(int argc, char* argv[]) if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); + regfree(®); return -1; } x(®, pattern, (UChar* )"aaaabbbbbbd"); @@ -77,6 +82,7 @@ extern int main(int argc, char* argv[]) if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); + regfree(®); return -1; } x(®, pattern, (UChar* )"aaabbbbd)"); @@ -86,11 +92,11 @@ extern int main(int argc, char* argv[]) if (r) { regerror(r, ®, buf, sizeof(buf)); fprintf(stderr, "ERROR: %s\n", buf); + regfree(®); return -1; } x(®, pattern, (UChar* )"a\nb\n"); - regfree(®); onig_end(); return 0; } |