diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2019-07-12 09:18:14 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2019-07-12 09:18:14 +0200 |
commit | e25c754918ae26e8b9e68a47bc1af36248e91800 (patch) | |
tree | d21952fcb2767620c25d4d5b412b8c4829ca96bc /sample/posix.c | |
parent | 70de057dbb5ea79536834e156f534279347f96f3 (diff) |
New upstream version 6.9.2upstream/6.9.2
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; } |