summaryrefslogtreecommitdiff
path: root/test/test_regset.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2021-04-26 17:34:16 +0200
committerJörg Frings-Fürst <debian@jff.email>2021-04-26 17:34:16 +0200
commiteac65ba44805c402f894b700b602c2e891f92a84 (patch)
tree8c74372bd97a480de440013af1dda4958189e24e /test/test_regset.c
parent7ce72ba4d420fde9672c2fb2dd7a6f5a26815e26 (diff)
parentdbedac4783f09292abb187d0c59d4032594038b6 (diff)
Merge branch 'release/debian/6.9.6-1'debian/6.9.6-1
Diffstat (limited to 'test/test_regset.c')
-rw-r--r--test/test_regset.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/test_regset.c b/test/test_regset.c
index c8442a1..7476ec4 100644
--- a/test/test_regset.c
+++ b/test/test_regset.c
@@ -50,6 +50,7 @@ make_regset(int line_no, int n, char* pat[], OnigRegSet** rset, int error_no)
nfail++;
}
}
+ onig_regset_free(set);
return r;
}
@@ -96,6 +97,7 @@ time_test(int repeat, int n, char* ps[], char* s, char* end, double* rt_set, dou
ONIG_REGSET_POSITION_LEAD, ONIG_OPTION_NONE, &match_pos);
if (r < 0) {
fprintf(stderr, "FAIL onig_regset_search(POSITION_LEAD): %d\n", r);
+ onig_regset_free(set);
return r;
}
}
@@ -109,6 +111,7 @@ time_test(int repeat, int n, char* ps[], char* s, char* end, double* rt_set, dou
ONIG_REGSET_REGEX_LEAD, ONIG_OPTION_NONE, &match_pos);
if (r < 0) {
fprintf(stderr, "FAIL onig_regset_search(REGEX_LEAD): %d\n", r);
+ onig_regset_free(set);
return r;
}
}
@@ -158,7 +161,10 @@ time_compare(int n, char* ps[], char* s, char* end)
for (i = 0; i < n; i++) {
fisher_yates_shuffle(n, ps, cps);
r = time_test(repeat, n, cps, s, end, &t_set, &t_reg);
- if (r != 0) return ;
+ if (r != 0) {
+ free(cps);
+ return ;
+ }
total_set += t_set;
total_reg += t_reg;
}
@@ -231,6 +237,7 @@ xx(int line_no, int n, char* ps[], char* s, int from, int to, int mem, int not,
if (region == 0) {
fprintf(stderr, "ERROR: %d: can't get region.\n", line_no);
nerror++;
+ onig_regset_free(set);
return ;
}
@@ -285,7 +292,7 @@ n(int line_no, int n, char* ps[], char* s)
static int
get_all_content_of_file(char* path, char** rs, char** rend)
{
- size_t len;
+ ssize_t len;
size_t n;
char* line;
FILE* fp;