]> git.ipfire.org Git - thirdparty/glibc.git/blob - posix/bug-regex15.c
manual: Revise crypt.texi.
[thirdparty/glibc.git] / posix / bug-regex15.c
1 /* Test for memory/CPU leak in regcomp. */
2
3 #include <error.h>
4 #include <sys/types.h>
5 #include <regex.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8
9 #define TEST_DATA_LIMIT (32 << 20)
10
11 static int do_test (void);
12 #define TEST_FUNCTION do_test ()
13 #include "../test-skeleton.c"
14
15 static int
16 do_test (void)
17 {
18 regex_t re;
19 int reerr;
20
21 reerr = regcomp (&re, "^6?3?[25]?5?[14]*[25]*[69]*+[58]*87?4?$",
22 REG_EXTENDED | REG_NOSUB);
23 if (reerr != 0)
24 {
25 char buf[100];
26 regerror (reerr, &re, buf, sizeof buf);
27 printf ("regerror %s\n", buf);
28 return 1;
29 }
30
31 return 0;
32 }