From afc58fa87c622092e24bd35b1aac389a45400647 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 13 Dec 2002 21:32:03 +0000 Subject: 2002-12-13 Roland McGrath * posix/bug-regex15.c: New file. * posix/Makefile (tests): Add it. --- posix/bug-regex15.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 posix/bug-regex15.c (limited to 'posix/bug-regex15.c') diff --git a/posix/bug-regex15.c b/posix/bug-regex15.c new file mode 100644 index 0000000000..8f6d3cc00d --- /dev/null +++ b/posix/bug-regex15.c @@ -0,0 +1,32 @@ +/* Test for memory/CPU leak in regcomp. */ + +#include +#include +#include +#include +#include + +#define TEST_DATA_LIMIT (32 << 20) + +static int do_test (void); +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" + +static int +do_test (void) +{ + regex_t re; + int reerr; + + reerr = regcomp (&re, "^6?3?[25]?5?[14]*[25]*[69]*+[58]*87?4?$", + REG_EXTENDED | REG_NOSUB); + if (reerr != 0) + { + char buf[100]; + regerror (reerr, &re, buf, sizeof buf); + printf ("regerror %s\n", buf); + return 1; + } + + return 0; +} -- cgit v1.2.1