summaryrefslogtreecommitdiff
path: root/sample/posix.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2019-07-13 14:54:01 +0200
committerJörg Frings-Fürst <debian@jff.email>2019-07-13 14:54:01 +0200
commit7bbf4ae1401bc6e40f71a32d3f97952796d85690 (patch)
tree61c3edf1a277547ecd11903427a31cd09cf42b8a /sample/posix.c
parentf883fa5bd37b6420f5dc25027a68289c64028063 (diff)
parent62c49103a575c79d20d524b36d1b7c4db9515dbf (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.c8
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, &reg, buf, sizeof(buf));
fprintf(stderr, "ERROR: %s\n", buf);
+ regfree(&reg);
return -1;
}
x(&reg, pattern, (UChar* )"aaabbbbd");
@@ -56,6 +59,7 @@ extern int main(int argc, char* argv[])
if (r) {
regerror(r, &reg, buf, sizeof(buf));
fprintf(stderr, "ERROR: %s\n", buf);
+ regfree(&reg);
return -1;
}
x(&reg, pattern, (UChar* )"a+b{2,7}d?|uuu");
@@ -66,6 +70,7 @@ extern int main(int argc, char* argv[])
if (r) {
regerror(r, &reg, buf, sizeof(buf));
fprintf(stderr, "ERROR: %s\n", buf);
+ regfree(&reg);
return -1;
}
x(&reg, pattern, (UChar* )"aaaabbbbbbd");
@@ -77,6 +82,7 @@ extern int main(int argc, char* argv[])
if (r) {
regerror(r, &reg, buf, sizeof(buf));
fprintf(stderr, "ERROR: %s\n", buf);
+ regfree(&reg);
return -1;
}
x(&reg, pattern, (UChar* )"aaabbbbd)");
@@ -86,11 +92,11 @@ extern int main(int argc, char* argv[])
if (r) {
regerror(r, &reg, buf, sizeof(buf));
fprintf(stderr, "ERROR: %s\n", buf);
+ regfree(&reg);
return -1;
}
x(&reg, pattern, (UChar* )"a\nb\n");
- regfree(&reg);
onig_end();
return 0;
}