summaryrefslogtreecommitdiff
path: root/sample/posix.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2019-07-12 09:18:14 +0200
committerJörg Frings-Fürst <debian@jff.email>2019-07-12 09:18:14 +0200
commite25c754918ae26e8b9e68a47bc1af36248e91800 (patch)
treed21952fcb2767620c25d4d5b412b8c4829ca96bc /sample/posix.c
parent70de057dbb5ea79536834e156f534279347f96f3 (diff)
New upstream version 6.9.2upstream/6.9.2
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;
}